四、Service

创建svc配置文件
cat >k8s_nginx_svc.yml<<EOF
apiVersion: v1
kind: Service
metadata:
  name: nginxsvc
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 30001
  selector:
    app: nginx
EOF
[root@k8s-m yml]# kubectl create -f k8s_nginx_svc.yml 
[root@k8s-m yml]# kubectl get svc
[root@k8s-m yml]# curl -I 10.0.0.13:30001
[root@k8s-m yml]# curl -I 10.0.0.12:30001

  

原文地址:https://www.cnblogs.com/zhugq02/p/12895650.html