Goal-seeking specifies the desired Kubernetes end state without prescribing the order or commands required to reach it. Submit a YAML manifest to the Kubernetes API, and the control plane reconciles current state toward the declared state. section 1.9
Choose the submission command according to the resource state:
- Use kubectl create -f when the resource should not already exist. section 1.9
- Use kubectl apply -f to create or update an existing resource. section 1.9
- Use kubectl replace -f to delete and recreate the resource, triggering a new Deployment rollout when applicable. section 1.9
Declare an nginx Pod
Define a Pod manifest with an nginx container, then submit it declaratively with kubectl create -f my-pod-manifest.yaml. Kubernetes selects and performs the path to the requested state. section 1.9
apiVersion: v1
kind: Pod
metadata:
labels:
run: nginx
name: nginx
spec:
containers:
- image: nginx
name: nginx
Inspect the concise YAML manifest structure for an nginx Pod. section 1.9
