Hello app redistribution deployment

Kubernetes deployment for GKE Hello app redistibution.

Code sample

YAML

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: hello-web
  name: hello-web
  namespace: default
spec:
  replicas: 3
  selector:
    matchLabels:
      app: hello-web
  template:
    metadata:
      labels:
        app: hello-web
    spec:
      # Pod anti affinity config START
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - labelSelector:
              matchExpressions:
              - key: app
                operator: In
                values:
                - hello-web
            topologyKey: kubernetes.io/hostname
      # Pod anti affinity config END
      containers:
      - image: us-docker.pkg.dev/google-samples/containers/gke/hello-app-redis:1.0  # change to the image name you built
        name: hello-app
        # Readiness probe config START
        readinessProbe:
          failureThreshold: 1
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 1
          periodSeconds: 1
          successThreshold: 1
          timeoutSeconds: 1

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.