k8s deployment pod 尽量分散在不同的node上

醉东枫

关注

阅读 50

2022-03-12

kind: Deployment
apiVersion: apps/v1
metadata:
  name: springboot-web-app1
  labels:
    k8s-app: springboot-web-app1
spec:
  replicas: 5  
  template:    
    spec:      
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: k8s-app
                    operator: In
                    values:
                      - springboot-web-app1
              topologyKey: kubernetes.io/hostname

精彩评论(0)

0 0 举报