Kubernetes Service与Endpoint指向外部服务

原创
2020/08/10 17:58
阅读数 5.7K
--------------------------------------------------
kubectl apply -f - <<EOF
kind: Service
apiVersion: v1
metadata:
  name: snake-demo-svc
  namespace: base
spec:
  ports:
  - port: 30018
    protocol: TCP
    name: http
  type: ClusterIP
  externalIPs: [192.168.48.92]
---
kind: Endpoints
apiVersion: v1
metadata: 
  name: snake-demo-svc
  namespace: base
subsets:
- addresses:
  - ip: 192.168.32.8
  ports:
   - port: 8080
     name: http
EOF

# kubectl describe svc snake-demo-svc -n base
# Endpoint与Service的metadata.name一致
# Endpoints.subsets[x].ports[x].name与Service.spec.ports[x].name一致
--------------------------------------------------
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部