Deploy Nagios on Kubernetes

Ticker

6/recent/ticker-posts

Deploy Nagios on Kubernetes

Question : The Nautilus DevOps team is planning to set up a Nagios monitoring tool to monitor some applications, services etc. They are planning to deploy it on Kubernetes cluster. Below you can find more details.

Create a deployment Nagios-deployment for Nagios core. The container name must be nagios-container 

Create a user & password for the Nagios Core Web Interface




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

Solution:  

1. At first  kubectl  utility configure and working from jump server, run below commands

    kubectl get deploy

    kubectl get services


2.  Create  nagios.yaml  file with all the parameters 

    ( Refer Below Video for more clarity )


---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nagios-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nagios-core
  template:
    metadata:
      labels:
        app: nagios-core
    spec:
      containers:
        - name: nagios-container
          image: jasonrivers/nagios
---
apiVersion: v1
kind: Service
metadata:
  name: nagios-service
spec:
  type: NodePort
  selector:
    app: nagios-core
  ports:
    - port: 80
      targetPort: 80
      nodePort: 30008

4.  Run below command to create pod

    kubectl create -f nagios.yaml

5.  Wait for deployment & pods to get running status

    kubectl get deploy

    kubectl get pods



6.  Run below command to login on pod & open shell 

    kubectl exec -it (pod name) -- /bin/bash


7.  As per the task set username & password for Nagios core web interface

       (Refer your task username & password)

    htpasswd /opt/nagios/etc/htpasswd.users xFusionCorp



8.  Validate the task by curl or open the browser by clicking 'Open Port on Host 1'


9.  Click on Finish & Confirm to complete the task successful

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

1 Comments

  1. How do you manage to spread the load due to multiple checks that nagios needs to perform? So that one kubernetes node does a couple of checks and a other node does the rest of the checks?

    ReplyDelete

Latest Posts

KodeKloud Kubernetes Security CKS  Lab Challenge 1 | Image Scanning using Aquasec Trivy | Secure Deployment using AppArmor Profile  | PVC to PV binding