Service资源
Posted l-dongf
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Service资源相关的知识,希望对你有一定的参考价值。
Service资源
service依赖DNS组件(CoreDNS)
工作模式:userspace, iptables, ipvs
类型:ExternalName, ClusterIP, NodePort, LoadBalancer
1、使用清单定义Service
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: default
spec:
selector:
app: redis
role: logstor
clusterIP: 10.97.97.97
type: ClusterIP
ports:
- port: 6379
targetPort: 6379
2、NodePort
apiVersion: v1
kind: Service
metadata:
name: myapp
namespace: default
spec:
selector:
app: myapp
release: canary
clusterIP: 10.99.99.99
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30080
3、会话粘性
# kubectl patch svc myapp -p '{"spec":{"sessionAffinity":"ClientIP"}}'
4、无头Service
apiVersion: v1
kind: Service
metadata:
name: myapp
namespace: default
spec:
selector:
app: myapp
release: canary
clusterIP: None
ports:
- port: 80
targetPort: 80
# dig -t A myapp-svc.default.svc.cluster.local. @$DNS_IP
以上是关于Service资源的主要内容,如果未能解决你的问题,请参考以下文章
Nginx——Nginx启动报错Job for nginx.service failed because the control process exited with error code(代码片段
java [Intent] Intent片段以启动Activity,Service或发送广播。 #android_snippet #android