kubectl is the Kubernetes command-line client for working with a cluster through its API. In a local inner loop, it is configured to target the current kind cluster, then used to verify cluster state and manage application resources. section 3.3.1 section 3.3.3
A practical kubectl workflow is:
- Confirm which cluster the CLI targets with `kubectl config current-context`; switch to `kind-devex-cluster` when needed. section 3.3.1
- Check cluster capacity with `kubectl get nodes`; the local cluster shown has one ready control-plane node. section 3.3.1
- Apply YAML manifests with `kubectl apply -f`, first for the PostgreSQL Cluster and then for application configuration. section 3.3.3
- Inspect the deployed application resources by label with `kubectl get all -l app=appointments`, and remove configuration with `kubectl delete -f config`. section 3.3.3
Manifests declare the resources kubectl asks the API to create. A deployable application commonly needs a Deployment for replicated Pods, a Service for in-cluster networking, and an Ingress for external access; ConfigMaps and Secrets can supply configuration and credentials. section 3.3.3
Deploying the Appointments service
Build a local image, load it into the kind cluster, and run `kubectl apply -f config`. The resulting Deployment runs the Appointments container, while related manifest resources expose it and connect it to the provisioned PostgreSQL database. Query `kubectl get all -l app=appointments` to confirm the labeled resources. 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
...
The Deployment manifest shows the declared container image and environment values that kubectl submits as a Kubernetes resource. section 3.3.3











