Grafana in kubernetes

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 namespace for Grafana grafana-monitoring-xfusion .

2.) Create grafana-deployment-xfusion deployment the namespace you created.

a. Replica counts should be 1 .

b. Container name should be grafana-container-xfusion and use grafana/grafana:latest image.

c. Container port should be 3000 . Set resources limits memory to 2Gi and CPU to 1000m , requests for memory 1Gi and for CPU 500m .

d. Volume mount name should be grafana-storage . Its mountPath should be /var/lib/grafana . Volume name should be grafana-storage , should be emptyDir {} .

3.) Create grafana-service-xfusion service under the same namespace. It must be of NodePort type, its port must be 3000 , target port must be 3000 and nodePort must be 32000 .

You can use any labels as per your choice.

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

i created the namespace, and below is yaml for deployment and service. I’m getting Imagepulloff error for pod. What i’m missing.

apiVersion: v1

kind: Service

metadata:

name: grafana-service-xfusion

labels:

app: grafana

spec:

type: NodePort

ports:

  • port: 3000

    targetPort: 3000

    nodePort: 32000

    protocol: TCP

selector:

app: grafana

apiVersion: apps/v1

kind: Deployment

metadata:

name: grafana-deployment-xfusion

spec:

selector:

matchLabels:

  app: grafana

replicas: 1

template:

metadata:

  labels:

    app: grafana

spec:

  containers:

  - name: grafana-container-xfusion

    image: grafana/grafana:latest

    ports:

    - containerPort: 3000

    resources:

     requests:

      memory: "1Gi"

      cpu: "500m"

     limits:

      memory: "2Gi"

      cpu: "1000m"

    volumeMounts:

    - name: grafana-storage

      mountPath: /var/lib/grafana

  volumes:

  - name: grafana-storage

    emptyDir: {}

It was a platform issue. Even i have faced the same issue. docker pull limits exceeds. Try after after sometime, it should work.

1 Like

In my case after I created namespace , added sting to Deployment and Service “namespace:grafana-deployment-xfusion”