kind: Deployment
apiVersion: apps/v1
metadata:
  annotations:
    litmuschaos.io/chaos: "true"
  labels:
    app: nginx-demo-app
  name: nginx-demo-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx-demo-app
  template:
    metadata:
      labels:
        app: nginx-demo-app
    spec:
      containers:
      - name: nginx-demo-app
        image: nginxdemos/hello:plain-text
        ports:
        - containerPort: 80
        readinessProbe:
          httpGet:
            port: 80
            path: /healthz
          initialDelaySeconds: 1
          periodSeconds: 5
          timeoutSeconds: 4
          successThreshold: 2
          failureThreshold: 3
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - nginx-demo-app
            topologyKey: kubernetes.io/hostname
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - nginx-demo-app
              topologyKey: failure-domain.beta.kubernetes.io/zone
---
kind: Service
apiVersion: v1
metadata:
  name: nginx-demo-app-svc
spec:
  type: NodePort
  selector:
    app: nginx-demo-app
  ports:
  - port: 80
    protocol: TCP
    name: http
---
