--- apiVersion: v1 kind: Service metadata: name: whoami labels: run: whoami spec: ports: - port: 80 protocol: TCP selector: run: whoami type: LoadBalancer --- apiVersion: apps/v1 kind: Deployment metadata: name: whoami spec: selector: matchLabels: run: whoami replicas: 2 template: metadata: labels: run: whoami spec: # affinity: # podAntiAffinity: # requiredDuringSchedulingIgnoredDuringExecution: # - labelSelector: # matchExpressions: # - key: app # operator: In # values: # - whoami # topologyKey: kubernetes.io/hostname containers: - name: whoami image: traefik/whoami ports: - containerPort: 80