--------------------------------------------------
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一致
--------------------------------------------------
Kubernetes Service与Endpoint指向外部服务
点赞
收藏