--- apiVersion: v1 kind: Service metadata: name: whoami2 labels: run: whoami2 spec: ports: - port: 80 protocol: TCP selector: run: whoami2 # type: LoadBalancer --- apiVersion: apps/v1 kind: Deployment metadata: name: whoami2 spec: selector: matchLabels: run: whoami2 replicas: 1 template: metadata: labels: run: whoami2 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