python/django/python-guestbook/kubernetes-manifests/guestbook-app.deployment.yaml (40 lines of code) (raw):

apiVersion: apps/v1 kind: Deployment metadata: name: python-guestbook-frontend labels: app: python-guestbook tier: frontend spec: replicas: 1 selector: matchLabels: app: python-guestbook tier: frontend template: metadata: labels: app: python-guestbook tier: frontend spec: initContainers: # Wait for the database to get ready before starting the server, otherwise # the server will crash - name: check-db-ready image: postgres command: ['sh', '-c', 'until pg_isready -h python-guestbook-db -p 5432; do echo waiting for database; sleep 2; done;'] containers: - name: frontend image: python-guestbook-frontend-django ports: - name: http-server containerPort: 8080 env: - name: DATABASE_NAME value: "postgres" - name: DATABASE_USER value: "postgres" - name: DATABASE_HOST value: "python-guestbook-db" - name: DATABASE_PORT value: "5432"