cloud professional services

Feb 15, 2023 6:11:41 PM by Mor Dvir

K9S - Manage Your Kubernetes Smart

Kubernetes, k9s

Kubernetes is one of the most popular deployments of container orchestration. It's also one of the fastest-growing technologies in cloud computing and DevOps communities. As Kubernetes continues to grow, it will be necessary for organizations to have a management platform that can help them manage their workloads on this open-source platform.

Why is it important to automate Kubernetes management?  

Managing Kubernetes can be time-consuming and complex. It's essential to automate your management process so that you can improve efficiency, security, and scale as needed.

K9s is a project that automates everyday tasks in Kubernetes environments. This makes it easier for organizations to manage their clusters without worrying about doing everything manually.

What is K9s?

K9s is an input/output terminal user interface for managing Kubernetes. It allows you to access, navigate and view your deployed applications in a single interface. The command line interface for managing Kubernetes makes it easier to access, navigate and view your deployed applications in one place.

K9s tracks changes made by DevOps teams so they can see how their changes affect production environments while also allowing them to create commands that interact with resources.

With K9s, you can use commands to access and manage your cluster's resources.

K9s is a tool that provides you with commands to access and manage your cluster's resources. It tracks real-time activities on Kubernetes standard and custom resources, handles both Kubernetes standard resources and custom resource definitions, and gives you commands for managing logs, restarts, scaling and port-forwards, etc.

Use the / command to search for resources.

K9s has a / command which you can use to search resources. This eliminates the need for long kubectl output chains and makes it easier to find what you're looking for.

You can use this functionality to search for resources based on their tags or a specific pattern match.

To view a resource, prefix the resource type with a colon (:). For example, if you want to see your pods, type: pods and hit enter.

Use j and k to navigate resources.

K9s makes it easy to navigate through your help. You can use j and k to navigate down and up through the returned resources. You can also use the arrow keys if you have lost your grasp on vim.

It's important because it allows users to quickly find what they're looking for in a sea of information--something that can be difficult when using traditional tools like kubectl or even Helm Charts.

Using the l command to view logs

To view logs in Kubernetes, you can use the l command. This is helpful for quickly tracking errors and issues. For example, if your application is not responding as it should and you want to see what happened before it went down, you can use p on your previous log entries so that they appear in chronological order.

The need for automated log viewing in Kubernetes becomes apparent when dealing with large amounts of data (such as when running multiple instances). The alternatives to K9s K8s log viewers are:

  • Kibana - An open-source tool used primarily by developers who want a graphical interface over their data because they find it easier than using CLI commands or text files;
  • Fluentd - A daemon process that collects logs from various sources, such as syslogs and application logs, into one place where they can be processed or stored;
  • Logstash - A tool used by DevOps teams who want centralized logging capabilities across multiple servers while allowing them flexibility when choosing where those servers will run from, geographically speaking.

Editing configurations 

K9s allows you to edit configurations in real-time. You can use the editor on any resource, from pods to services and custom resources. The changes you make will affect your cluster immediately, but these changes can be overwritten by future CI/CD deployments.

K9s provides a node-level operation called "cordoning" that allows you to pause all containers running on a node until they are drained cleanly or deleted (once drained). This helps prevent accidental termination of running containers during configuration changes or upgrades.

There are also alternatives, such as K8s Config Editor, which provide similar functionality but less flexibility than K9s.

Monitoring and visualizing resources and events

K9s make it easy to monitor and visualize resources and events. Use: pulses mode to visualize resources or Tab to select the exact pulse you want to see more details about. If there are any warnings or errors associated with your cluster, they will be displayed here as well so that you can take action right away!

The d command provides detailed descriptions of all events and warnings generated by the K9s smartwatch monitoring system.

Create command shortcuts with aliases. 

As you start working with K9s, you'll find yourself typing commands repeatedly. To speed up these repetitive tasks, you can create shortcuts with aliases.

To get started, create an alias file in the .k9s/ directory:

  • Run cd $HOME/.k9s to find the correct directory
  • Then create an alias.yml file using your favorite text editor (vim or nano)
  • Define it in the format of alias: group/version/resource

Achieve configuration best practices with Popeye scanning 

Popeye is a tool for scanning Kubernetes configurations. It examines a configuration and generates a report of the findings. You can then open this report using the: popeye command in your terminal, which will open up a scan summary page that lists all components analyzed by Popeye.

The next step would be to dig into each component, but we'll leave that for another time.

 

Conclusion

K9s is an excellent tool for managing your Kubernetes cluster. It allows you to easily manage the resources used by your applications and ensure that they run smoothly.

 

Subscribe

Click to subscribe our blog

FILL THE FORM

Subscribe our Blog

Subscribe today

For weekly special offers and new updates!