0
0
Kubernetesdevops~10 mins

Grafana for visualization in Kubernetes - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to deploy Grafana using kubectl.

Kubernetes
kubectl create deployment grafana --image=[1]
Drag options to blanks, or click blank then click option'
Amysql:5.7
Bnginx:latest
Credis:alpine
Dgrafana/grafana:latest
Attempts:
3 left
💡 Hint
Common Mistakes
Using images unrelated to Grafana like nginx or redis.
Forgetting to specify the image tag.
2fill in blank
medium

Complete the command to expose Grafana deployment as a service.

Kubernetes
kubectl expose deployment grafana --type=[1] --port=3000
Drag options to blanks, or click blank then click option'
AClusterIP
BLoadBalancer
CNodePort
DExternalName
Attempts:
3 left
💡 Hint
Common Mistakes
Using ClusterIP which is internal only.
Using ExternalName which maps to external DNS.
3fill in blank
hard

Fix the error in the YAML snippet to set Grafana admin password.

Kubernetes
apiVersion: v1
kind: Secret
metadata:
  name: grafana-secret
type: Opaque
data:
  admin-password: [1]
Drag options to blanks, or click blank then click option'
AYWRtaW4=
Badmin
Cpassword123
DcGFzc3dvcmQ=
Attempts:
3 left
💡 Hint
Common Mistakes
Putting plain text instead of base64 encoded string.
Using wrong base64 encoding.
4fill in blank
hard

Fill both blanks to create a ConfigMap for Grafana datasource with Prometheus URL.

Kubernetes
apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-datasource
data:
  datasource.yaml: |-
    apiVersion: 1
    datasources:
      - name: Prometheus
        type: [1]
        url: [2]
Drag options to blanks, or click blank then click option'
Aprometheus
B"http://prometheus-server.default.svc.cluster.local:9090"
C"http://localhost:9090"
Dinfluxdb
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong datasource type like influxdb.
Using localhost URL which won't work inside Grafana pod.
5fill in blank
hard

Fill all three blanks to create a Pod with Grafana container and environment variable for admin password.

Kubernetes
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]
Drag options to blanks, or click blank then click option'
Agrafana/grafana:latest
Bgrafana-secret
Cadmin-password
Dnginx:latest
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong container image like nginx.
Mismatching secret name or key.