Complete the code to define a headless service by setting the correct clusterIP value.
apiVersion: v1 kind: Service metadata: name: my-headless-service spec: clusterIP: [1] selector: app: myapp ports: - protocol: TCP port: 80 targetPort: 9376
Setting clusterIP: None creates a headless service in Kubernetes.
Complete the command to create a headless service from a YAML file named service.yaml.
kubectl [1] -f service.yamlThe kubectl apply command creates or updates resources from a YAML file.
Fix the error in the service selector to correctly match pods with label 'app: myapp'.
spec:
selector:
app: [1]The selector must exactly match the pod label value 'myapp' to select the pods correctly.
Fill both blanks to create a headless service that selects pods labeled 'app: web' and exposes port 8080.
spec: clusterIP: [1] selector: app: [2] ports: - port: 8080
Setting clusterIP: None makes the service headless, and the selector must match the pod label 'web'.
Fill all three blanks to define a headless service with name 'db-service', selecting pods labeled 'role: database' and exposing port 5432.
apiVersion: v1 kind: Service metadata: name: [1] spec: clusterIP: [2] selector: role: [3] ports: - port: 5432
The service name is 'db-service', clusterIP is 'None' for headless, and selector matches pods with label 'role: database'.