Complete the code to deploy Grafana using kubectl.
kubectl create deployment grafana --image=[1]The correct image for Grafana is grafana/grafana:latest. Other images are unrelated services.
Complete the command to expose Grafana deployment as a service.
kubectl expose deployment grafana --type=[1] --port=3000
Using NodePort exposes the service on each node's IP at a static port, allowing external access for testing.
Fix the error in the YAML snippet to set Grafana admin password.
apiVersion: v1
kind: Secret
metadata:
name: grafana-secret
type: Opaque
data:
admin-password: [1]
The data field in Kubernetes secrets requires base64 encoded values. YWRtaW4= is base64 for 'admin'.
Fill both blanks to create a ConfigMap for Grafana datasource with Prometheus URL.
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-datasource
data:
datasource.yaml: |-
apiVersion: 1
datasources:
- name: Prometheus
type: [1]
url: [2]
The datasource type for Prometheus is prometheus. The URL must point to the Prometheus service inside the cluster.
Fill all three blanks to create a Pod with Grafana container and environment variable for admin password.
apiVersion: v1
kind: Pod
metadata:
name: grafana-pod
spec:
containers:
- name: grafana
image: [1]
ports:
- containerPort: 3000
env:
- name: GF_SECURITY_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: [2]
key: [3]
The container image must be Grafana's official image. The secret name and key must match the secret storing the admin password.