码迷,mamicode.com
首页 > 其他好文 > 详细

Service资源

时间:2018-11-08 23:18:23      阅读:191      评论:0      收藏:0      [点我收藏+]

标签:ada   cluster   adb   lease   api   组件   table   sel   依赖   

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资源

标签:ada   cluster   adb   lease   api   组件   table   sel   依赖   

原文地址:https://www.cnblogs.com/L-dongf/p/9932335.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!