apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/component: demo
    app.kubernetes.io/instance: my-special-precious-one
    app.kubernetes.io/name: hellosvc
    app.kubernetes.io/version: "1.8"
  name: my-special-precious-one
  namespace: special
spec:
  replicas: 3
  selector:
    matchLabels:
      app.kubernetes.io/component: demo
      app.kubernetes.io/instance: my-special-precious-one
      app.kubernetes.io/name: hellosvc
  template:
    metadata:
      labels:
        app.kubernetes.io/component: demo
        app.kubernetes.io/instance: my-special-precious-one
        app.kubernetes.io/name: hellosvc
        app.kubernetes.io/version: "1.8"
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app.kubernetes.io/name
                  operator: In
                  values:
                  - hellosvc
              namespaces:
              - special
              topologyKey: kubernetes.io/hostname
            weight: 100
      containers:
      - image: paulbouwer/hello-kubernetes:1.8
        livenessProbe:
          failureThreshold: 4
          httpGet:
            path: /-/healthy
            port: 80
            scheme: HTTP
          periodSeconds: 30
        name: my-special-precious-one
        ports:
        - containerPort: 80
          name: http
        readinessProbe:
          failureThreshold: 20
          httpGet:
            path: /-/ready
            port: 80
            scheme: HTTP
          periodSeconds: 5
        resources:
          limits:
            memory: 200m
        terminationMessagePolicy: FallbackToLogsOnError
      terminationGracePeriodSeconds: 1
