如何让kind: StatefulSet创建的pod轮询起来


[root@dock01 ~]# cat t007.yaml 
apiVersion: v1
kind: Service
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  ports:
  - port: 80
    name: web
  clusterIP: None
  selector:
    app: nginx
    
    
[root@dock01 ~]# cat t008.yaml 
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: web
spec:
  serviceName: "nginx"
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
       containers:
       - name: tomcat1-20210216
         image: 192.168.137.102:5000/centos_tomcat_v7
         command: ["/bin/sh","-c","sleep 3600"]
[root@dock01 ~]# 


$ kubectl get service nginx
NAME      TYPE         CLUSTER-IP   EXTERNAL-IP   POR

你可能感兴趣的:(kubernetes,进阶)