k8s修改svc label 更新应用

app1:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx-2
spec:
  selector:
    matchLabels:
      run: my-nginx-2
  replicas: 1
  template:
    metadata:
      labels:
        run: my-nginx-2
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
        - containerPort: 80

app2:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-nginx
spec:
  selector:
    matchLabels:
      run: my-nginx
  replicas: 2
  template:
    metadata:
      labels:
        run: my-nginx
    spec:
      containers:
      - name: my-nginx
        image: nginx
        ports:
        - containerPort: 80

svc:

apiVersion: v1
kind: Service
metadata:
  name: my-nginx
  labels:
    run: my-nginx
spec:
  ports:
  - port: 80
    protocol: TCP
  selector:
    run: my-nginx

 

busybox,切换svc标签后的表现:

kubectl run curl --image=radial/busyboxplus:curl -i --tty
 

 

 

以上都是静态页面所以测不出大并发的情况下直接切换给系统带来的影响。

posted @ 2022-06-02 14:33  JvvYou  阅读(209)  评论(0编辑  收藏  举报