Azure / kdebug

A troubleshooting tool for Kubernetes​
MIT License
50 stars 14 forks source link

Bad scheduling checker #80

Open ArchangelSDY opened 1 year ago

ArchangelSDY commented 1 year ago

Background

Sometimes pods can be scheduled in a non-HA way. For example, all pods in a deployment scheduled to a single machine, or a single zone. Authoring a deployment with HA is hard for beginners. We should be able to point out such risks and guide users to configure pod spread topology properly.

Goals

Non-goals

References

zackliu commented 1 year ago

A test spec

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/hostname
                operator: In
                values:
                - <node-name>
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80