Complete the code to create a Kubernetes Pod manifest with one container.
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: my-container
image: [1]The image field requires the container image name, like nginx:latest. Commands like docker run or kubectl apply are not valid here.
Complete the command to deploy a Kubernetes manifest file named app.yaml.
kubectl [1] -f app.yamlkubectl run which creates a pod directlykubectl delete which removes resourcesThe kubectl apply command applies the configuration in the manifest file to the cluster, creating or updating resources.
Fix the error in the command to list all pods in all namespaces.
kubectl get pods [1]-a which is not valid for namespaces--namespace=all which is invalidThe correct flag to list pods across all namespaces is --all-namespaces. Other options are invalid or do not work as expected.
Fill both blanks to create a Deployment manifest with 3 replicas of an nginx container.
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment spec: replicas: [1] selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: [2]
The replicas field should be set to 3 to run three pods. The image should be a valid container image like nginx:latest.
Fill all three blanks to create a Service manifest exposing port 80 for the nginx Deployment.
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: [1]
ports:
- protocol: TCP
port: [2]
targetPort: [3]The selector should match the label app: nginx. The port and targetPort should both be set to 80 to expose the nginx container's port.