This repository contains a Bash script that automates the process of checking various components of a Kubernetes cluster. The script provides a quick overview of the cluster's health and configuration status by running essential kubectl commands. It helps you verify nodes, pods, services, deployments, namespaces, configmaps, metrics, events, and Helm releases in your Kubernetes setup.
- Check the status of Kubernetes nodes
- Get the cluster's control plane information
- List all pods in the cluster
- Retrieve services and deployments in the default namespace
- List namespaces and configmaps across all namespaces
- Display resource usage metrics for nodes and pods (if metrics-server is installed)
- List events sorted by creation timestamp
- Check Helm releases (if Helm is installed)
- Kubernetes: Ensure your cluster is up and running.
- kubectl: The script assumes you have
kubectlinstalled and configured to access your cluster. - Helm (optional): The script will check if Helm is installed and list Helm releases if available.
- Metrics-server (optional): To retrieve metrics data for nodes and pods, you must have the metrics-server installed in your cluster.
-
Clone this repository:
git clone https://github.com/Raafay892/k8S_CHECK.git cd K8S_CHECK -
Make the script executable:
chmod +x k8s_check.sh
-
Run the script:
./k8s_check.sh
The script will output the status of your Kubernetes components in the terminal.
kubectl get nodes: Displays the nodes in the cluster.kubectl cluster-info: Provides control plane information.kubectl get pods --all-namespaces: Lists all pods across namespaces.kubectl get svc: Lists services in the default namespace.kubectl get deployments: Lists deployments in the default namespace.kubectl get namespaces: Lists all namespaces.kubectl get configmap --all-namespaces: Lists all configmaps across namespaces.kubectl top nodes: Displays resource usage for nodes (if metrics-server is installed).kubectl top pods --all-namespaces: Displays resource usage for pods (if metrics-server is installed).kubectl get events --sort-by='.metadata.creationTimestamp': Lists events in the cluster sorted by creation timestamp.helm list: Displays Helm releases (if Helm is installed).
This project is licensed under the MIT License - see the LICENSE file for details.