Deploy Grafana on Kubernetes Cluster

Ticker

6/recent/ticker-posts

Deploy Grafana on Kubernetes Cluster

 Question : The Nautilus DevOps teams is planning to set up a Grafana tool to collect and analyze analytics from some applications. They are planning to deploy it on Kubernetes cluster. Below you can find more details.

1.) Create a deployment named grafana-deployment-nautilus using any grafana image for Grafana app. Set other parameters as per your choice.

2.) Create NodePort type service with nodePort 32000 to expose the app.

You need not to make any configuration changes inside the Grafana app once deployed, just make sure you are able to access the Grafana login page.

Note: The kubeclt on jump_host has been configured to work with kubernetes cluster.

Please Note :-  Perform the below commands based on your question server,  user name & other details that might differ. So please read the task carefully before executing it. 
All the Best 👍
Solution:  

1. Check existing running Pods  & Services 

thor@jump_host ~$ kubectl get pods

No resources found in default namespace.

thor@jump_host ~$

thor@jump_host ~$ kubectl get services

NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE

kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   13m

thor@jump_host ~$


2.  Create a YAML  file with all the parameters,  Kindly do the changes as per task

you can copy from GitLab    https://gitlab.com/nb-tech-support/devops.git

    Refer Below Video for more clarity )

thor@jump_host ~$ vi /tmp/grafana.yaml

thor@jump_host ~$ cat /tmp/grafana.yaml

apiVersion: v1

kind: Service

metadata:

  name: grafana-service-nautilus

spec:

  type: NodePort

  selector:

    app: grafana

  ports:

    - port: 3000

      targetPort: 3000

      nodePort: 32000

---

apiVersion: apps/v1

kind: Deployment

metadata:

  name: grafana-deployment-nautilus

spec:

  selector:

    matchLabels:

      app: grafana

  template:

    metadata:

      labels:

        app: grafana

    spec:

      containers:

        - name: grafana-container-nautilus

          image: grafana/grafana:latest

          ports:

            - containerPort: 3000

thor@jump_host ~$

3. Run the below command to create a pod 

thor@jump_host ~$ kubectl create -f /tmp/grafana.yaml

service/grafana-service-nautilus created

deployment.apps/grafana-deployment-nautilus created

thor@jump_host ~$ 


4.  Wait for the pod to get completed status

thor@jump_host ~$ kubectl get service

NAME                       TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE

grafana-service-nautilus   NodePort    10.96.194.115   <none>        3000:32000/TCP   14s

kubernetes                 ClusterIP   10.96.0.1       <none>        443/TCP          15m

thor@jump_host ~$

thor@jump_host ~$ kubectl get pods

NAME                                           READY   STATUS    RESTARTS   AGE

grafana-deployment-nautilus-66bb8cdd8b-2tp4h   1/1     Running   0          22s

thor@jump_host ~$



5.  Validate the task by open port view WUI

6.  Click on Finish & Confirm to complete the task successfully

Happy Learning!!!!

Apart from this if you need more clarity,  I have made a  tutorial video on this, please go through and share your comments. Like and share the knowledge 



Post a Comment

0 Comments

Latest Posts

KodeKloud Kubernetes Security CKS  Lab Challenge 4 |  Audit-policy | Install & configure falco utility | Inspect the API server audit logs and identify the user