1 2 - K9S
Tomislav Kopić edited this page 2024-05-20 09:50:56 +00:00

Guide to Basic Components of Kubernetes and How to Use k9s to Navigate Them

Basic Components of Kubernetes

  1. Nodes: Nodes are the individual servers or virtual machines that form the Kubernetes cluster. Each node runs various Kubernetes services and can host multiple pods.

  2. Pods: Pods are the smallest deployable units in Kubernetes and represent one or more containers that share the same network namespace and storage. They are the basic building blocks of Kubernetes applications.

  3. Services: Services provide a consistent way to access a set of pods. They abstract away the underlying network infrastructure, allowing applications to be decoupled from the specific details of how they are accessed.

  4. ReplicaSets: ReplicaSets ensure that a specified number of pod replicas are running at any given time. They are responsible for scaling and maintaining the desired number of pod replicas in the cluster.

  5. Deployments: Deployments are higher-level abstractions that manage ReplicaSets and provide declarative updates to pods and ReplicaSets. They enable easy scaling, rolling updates, and rollback capabilities for applications.

  6. Namespace: Namespaces provide a way to organize and isolate resources within a Kubernetes cluster. They are virtual clusters within the same physical cluster and help in multi-tenancy and resource management.

Using k9s to Navigate Kubernetes

k9s is a powerful command-line interface (CLI) tool for Kubernetes that provides a terminal-based UI to interact with your Kubernetes clusters. It offers a convenient way to view and manage various Kubernetes resources.

Installation

You can install k9s using various methods, such as Homebrew (for macOS and Linux), Chocolatey (for Windows), or by downloading the binary from the GitHub releases page.

Usage

Once installed, launch k9s by simply running the k9s command in your terminal.

Navigating Resources

k9s provides a user-friendly interface to navigate through various Kubernetes resources. You can use arrow keys to navigate, and press Enter to view detailed information about a resource.

Viewing Resources

To navigate through Kubernetes components with k9s, you can use the ":" command. For example, to view all namespaces, just type:

:namespace 

You can then use the arrow keys and press Enter to navigate through them.

Some useful resources and their shortcuts include:

  • :nodes: View all nodes in the cluster.
  • :namespaces (:ns): View all namespaces.
  • :pods: View all pods running in the cluster.
  • :ingress (:ing): View all Ingress resources.
  • :services: View all services deployed in the cluster.
  • :deployments (:deploy): View all deployments.
  • :statefulset (:sts): View all StatefulSets.

You can explore other resources using similar commands prefixed with ":".

Searching and Filtering

You can search and filter through any tab in k9s using the "/" command. Simply type "/" followed by your search query, and k9s will filter the results accordingly. This is particularly useful when dealing with large numbers of resources or when looking for specific items.