58/100 Deploy Grafana on Kubernetes Cluster
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.
- Create a deployment named grafana-deployment-nautilus using any grafana image for Grafana app. Set other parameters as per your choice.
- Create NodePort type service with nodePort 32000 to expose the app.
First, create the yaml manifest file named grafana-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana-deployment-nautilus
spec:
replicas: 1
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
containers:
- name: grafana-container
image: grafana/grafana:latest
ports:
- containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: grafana-service
spec:
type: NodePort
selector:
app: grafana
ports:
- port: 3000
targetPort: 3000
nodePort: 32000
Deploy:
thor@jumphost ~$ kubectl apply -f grafana-deployment.yaml
deployment.apps/grafana-deployment-nautilus created
service/grafana-service created
thor@jumphost ~$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
grafana-deployment-nautilus 0/1 1 0 19s
# Check the service (optional)
thor@jumphost ~$ kubectl get svc grafana-service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
grafana-service NodePort 10.96.117.133 <none> 3000:32000/TCP 43s