Complete the code to define a StatefulSet with the correct API version.
apiVersion: apps/[1] kind: StatefulSet metadata: name: web spec: selector: matchLabels: app: nginx serviceName: "nginx" replicas: 3 template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.15.4
The correct API version for StatefulSet is apps/v1.
Complete the code to specify the volumeClaimTemplates section for persistent storage.
volumeClaimTemplates:
- metadata:
name: [1]
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 1GiThe name under volumeClaimTemplates is typically called data to represent the persistent volume claim for the pod.
Fix the error in the selector section to correctly match the pod labels.
selector:
matchLabels:
app: [1]The selector must match the label used in the pod template. Here, the pod label is app: nginx, so the selector should match nginx.
Fill both blanks to complete the container volume mount and volume claim reference.
containers: - name: nginx image: nginx:1.15.4 volumeMounts: - name: [1] mountPath: [2]
The volumeMount name must match the volumeClaimTemplates name, which is 'data'. The mountPath is the directory inside the container where the volume is mounted, commonly /usr/share/nginx/html for nginx.
Fill all three blanks to complete the StatefulSet spec with replicas, serviceName, and pod label.
spec: replicas: [1] serviceName: "[2]" template: metadata: labels: app: [3]
The number of replicas is 3 for three pods. The serviceName is 'nginx' to match the headless service. The pod label 'app' is set to 'nginx' to match the selector.