A Pod represents an application container in Kubernetes. A Deployment manages the lifecycle of a stateless, replicated application, with each replica consisting of a Pod. section 3.3.3
Connect a Pod to the surrounding application workflow:
- Define the Pod through a Deployment manifest, including its container image, labels, and environment configuration. section 3.3.3
- Expose the replicated application with a Service, and make it reachable from outside the cluster through an Ingress. section 3.3.3
- Supply configuration or credentials with ConfigMap and Secret resources. section 3.3.3
Appointments service
A Deployment runs the appointments application as a Pod, using an image and PostgreSQL settings obtained from Secret references. Apply the configuration, inspect resources with kubectl, and call the service over HTTP. section 3.3.3
Listing 3.1 Deployment configuration for a cloud native application.
apiVersion: apps/v1
kind: Deployment
metadata:
name: appointments #A
labels:
app: appointments
spec:
selector:
matchLabels:
app: appointments
template:
metadata:
labels:
app: appointments
spec:
containers:
- name: appointments #B
image: ko.local/appointments:0.0.1-SNAPSHOT #C
env: #D
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: db-appointments-app
key: host
- name: POSTGRES_PORT
valueFrom:
secretKeyRef:
name: db-appointments-app
key: port
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: db-appointments-app
key: dbname
- name: POSTGRES_USERNAME
valueFrom:
secretKeyRef:
name: db-appointments-app
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: db-appointments-app
key: password
...
Inspect the Deployment manifest that declares the Pod template, container image, labels, and environment variables. section 3.3.3















