Boost Your Career: Master Installing Kube-Green on Kubernetes Cluster
Overview :-
Kubernetes is widely recognized as a leading platform for orchestrating containers. Many organizations have already adopted the Kubernetes platform to manage their applications and products. In a typical organization, Kubernetes clusters are often created for development, testing, or running production workloads, among other tasks. While this setup accommodates various workloads, it’s essential to consider that the cost correlates directly with the number of clusters established.
If implementing these scenarios is desired, consider using kube-green.
How It Works
Kube-green deactivates the following resources:
Deployments
Cronjobs
Note: By default, only deployment pods are stopped. If you wish to stop cronjob pods, you need to enable this feature explicitly. We’ll address this scenario later.
Creating a Kubernetes Cluster :-
A Kubernetes cluster is required to test the functionality of kube-green. You can use any Kubernetes cluster, such as AWS EKS, Google GKE, Azure AKS, minikube, or kind.
I will proceed with a kind Kubernetes cluster.
kind create cluster --name kube-green
Note: If you’re unfamiliar with kind or how to create a Kubernetes cluster using it, please refer to my other blog.
Next, switch to the new context using this command:
kubectl cluster-info --context kind-kube-green
You can verify the cluster with any of these commands:
kubectl get nodes
kubectl get componentstatus
Installing cert-manager :-
It is necessary to install cert-manager because kube-green depends on cert-manager for issuing certificates. Use the following command to install cert-manager:
kubectl apply -f https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.yaml
Wait until all pods transition to the running state.
kubectl get pods -n cert-manager
Installing kube-green :-
There are several methods to install kube-green, such as kubectl apply, kustomize, or via an operator.
In this demonstration, I’ll use the simplest method, which is kubectl apply. Execute the following command:
kubectl apply -f https://github.com/kube-green/kube-green/releases/latest/download/kube-green.yaml
This command creates several resources, which are visible in the provided screenshot. A new namespace called “kube-green” is created, and the controller pod will be deployed within it.
kubectl get pods -n kube-green
Additionally, a custom resource definition named “sleepinfos.kube-green.com” is created, which can be viewed using the following command:
kubectl get crds | grep sleep
This Custom Resource Definition (CRD) is used to define when resources will be shut down and woken up.
Conclusion :-
And there you have it, folks! We’ve walked through the process of installing Kube-Green on your Kubernetes cluster. I hope you found this guide helpful and not too overwhelming. Remember, like any new skill, it might take a bit of practice to get comfortable with Kube-Green, but it’s totally worth it.