Today we will see a tool called "Polaris" which helps to keep your Kubernetes cluster running perfectly using best practices without any issues.

Requirements :

1. Kubernetes(K8s) cluster

2. A machine(mine is Mac) to install Polaris and have access to the cluster


Step 1: Install Polaris

Execute the following commands in the terminal,

brew tap reactiveops/tap


brew install reactiveops/tap/polaris


polaris dashboard --port 8080

Make sure you are able to access the K8s cluster from the machine where you installed Polaris.

To install via helm charts use below commands,

helm repo add fairwinds-stable https://charts.fairwinds.com/stable


helm upgrade --install polaris fairwinds-stable/polaris --namespace polaris --create-namespace


kubectl port-forward --namespace polaris svc/polaris-dashboard 8080:80


Step 2: Polaris Dashboard

Next, go to the browser using http://127.0.0.1:8080

The overview gives you the following details,

  • Grade
  • Score
  • Passed checks
  • Warning
  • Critical/Dangerous
  • k8s version, no. of namespaces, pods,etc
If you scroll down it will give much more details about each deployment and its open items. For example I have deployed "Grafana" in K8s cluster and see the status below,


In the above image, you can see how many criticals and warnings are there for Grafana deployment. Next, we need to fix one by one and make the best practices to bring the K8s cluster for running smoothly.

We can create our own custom checks and the details are here,
https://polaris.docs.fairwinds.com/customization/custom-checks/#basic-example

Step 3: Polaris Command line checks

We can run the checks from the command line as well.

For example, Am using the below nginx deployment file, to check from Polaris commands and see how many open items are there.

https://github.com/Kurento/Kubernetes/blob/master/nginx-deployment-service.yaml

File name: nginx.yaml and copied the file into the devopsart folder.

Below Polaris command to run locally,


polaris audit --audit-path ./devopsart --format=pretty



If we want to fix the issues by running the below command it will fix all the critical items.

polaris fix --files-path ./devopsart/ --checks=all

We can run it CI pipeline the details are available here,

https://polaris.docs.fairwinds.com/infrastructure-as-code/#running-in-a-ci-pipeline


That's all, We have installed the Polaris tool and successfully checked the Critical and warning items.



Post a Comment

Previous Post Next Post