Voiced by Amazon Polly |
Introduction
Managing Kubernetes clusters can often feel overwhelming, especially when dealing with multiple pods, containers, and deployments. However, with the right tools, you can simplify the entire process and make cluster management much more efficient. In this blog, we’ll explore some of the top Kubernetes tools, like K9s for cluster management and Stern for real-time log monitoring, that will help you interact with your Kubernetes setup effortlessly from your local machine. Whether you’re a developer or an operator, these tools are essential for streamlining navigation, troubleshooting, and monitoring, making Kubernetes management feel like a breeze.
Pioneers in Cloud Consulting & Migration Services
- Reduced infrastructural costs
- Accelerated application deployment
Cluster Management
K9s
K9s is a terminal-based UI designed to simplify interaction with Kubernetes clusters. This tool streamlines the real-time navigation, observation, and management of deployed applications. Continuously monitoring Kubernetes for changes, K9s provides intuitive commands to help you efficiently manage and interact with your cluster resources. Perfect for developers and operators, K9s enhance productivity by offering a smooth and accessible way to handle complex Kubernetes environments.
Installation:
- Via Webi for Linux and macOS
1 |
curl -sS https://webinstall.dev/k9s | bash |
- For other ways, visit documentation – GitHub – derailed/k9s: 🐶 Kubernetes CLI To Manage Your Clusters In Style!
Few useful commands:
- Launching k9s
Simply type k9s in your terminal and hit Enter.
2. Example Commands with k9s.
- Example 1: Press enter on the pod name to retrieve Pod details
- Example 2: Press enter on the container name to view the logs of Pod
- Example 3: To view Daemonset, press: and type daemonsets
- To quit the Terminal, press: and type q
Log monitoring
Stern
Stern is an open-source tool for real-time log aggregation from multiple Kubernetes pods and containers. It provides a powerful way to tail and search logs across all or selected pods in a Kubernetes cluster, making it much easier to troubleshoot, monitor, and debug applications. Stern allows you to filter logs based on namespace, pod, container, and even specific labels, giving you flexibility when dealing with multiple workloads.
Installation:
- Linux and macOS
brew install stern
- For other ways, visit documentation – GitHub – stern/stern: ⎈ Multi pod and container log tailing for Kubernetes — Friendly fork of https://github.com/wercker/stern
Few useful commands:
Get all logs in a given namespace
Example: stern . -n <namespace>
Filter logs for a specific deployment
Example: stern -l app=<deployment-name> –include “<search-string>”
Security
kubesec
KubeSec is a tool designed to assess the security of Kubernetes manifests. It helps detect potential security risks by analyzing YAML files that define Kubernetes resources such as Pods, Deployments, or Services. The primary goal of KubeSec is to ensure that the Kubernetes clusters and applications running on them follow best security practices.
Installation:
- On Linux – download the latest release: https://github.com/controlplaneio/kubesec/releases/download/v2.14.1/kubesec_linux_amd64.tar.gz
- tar -xvf kubesec_linux_amd64.tar.gz
- mv kubesec /usr/local/bin/
Few useful commands:
Kubesec scan <manifest.yaml>
kubent
Kubent (Kubernetes Event Notifier) is a tool designed to detect deprecated Kubernetes APIs in your cluster, ensuring that your applications and resources are compatible with the version of Kubernetes you are running. As Kubernetes evolves, certain APIs and features get deprecated or removed, so keeping track of deprecated resources before upgrading is important to avoid breaking changes.
Installation:
- On Linux – sh -c “$(curl -sSL https://git.io/install-kubent)”
Few useful commands:
- Simply type kubent to see the results in case of having the kubeconfig in different location use the below command
kubent -k < kubeconfig file path>
Local Kubernetes tool
K3s
K3s is a lightweight, fully certified Kubernetes distribution designed for resource-constrained environments. Developed by Rancher Labs, K3s is designed to provide a simple, easy-to-install, low-resource solution for running Kubernetes clusters in edge computing, IoT devices, and development setups. K3s is optimized for minimal CPU, memory, and storage footprints, making it ideal for small-scale clusters, embedded devices, and development purposes.
Installation:
- On Linux – curl -sfL https://get.k3s.io | sh –
Few useful commands:
- sudo k3s kubectl get node
- sudo k3s kubectl create deploy nginx –image=nginx
- sudo k3s kubectl get pods
Conclusion
Managing Kubernetes clusters doesn’t have to be overwhelming. Tools like K9s, Stern, Kubesec, Kubent, and K3s simplify cluster management, real-time log monitoring, security assessment, and deprecated API detection.
By incorporating these powerful tools into your workflow, you can make Kubernetes management hassle-free and more efficient.
Drop a query if you have any questions regarding Kubernetes and we will get back to you quickly.
Empowering organizations to become ‘data driven’ enterprises with our Cloud experts.
- Reduced infrastructure costs
- Timely data-driven decisions
About CloudThat
CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.
CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, AWS GenAI Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, Amazon ECS Service Delivery Partner, AWS Glue Service Delivery Partner, Amazon Redshift Service Delivery Partner, AWS Control Tower Service Delivery Partner, AWS WAF Service Delivery Partner and many more.
To get started, go through our Consultancy page and Managed Services Package, CloudThat’s offerings.
FAQs
1. Can K9s be used with multiple Kubernetes clusters?
ANS: – Yes, K9s can be configured to switch between multiple Kubernetes clusters. You can use K9s with different kubeconfig
contexts to manage multiple clusters from a single interface. Simply switch contexts within K9s or use kubectl config use-context
before launching K9s.
2. Does Stern support log coloring to differentiate between pods or containers?
ANS: – Yes, Stern supports color-coded output, making it easier to differentiate between logs from different pods or containers. Each pod/container gets its color in the terminal, making the logs more visually distinct and easier to track.
WRITTEN BY Aishwarya M
Click to Comment