Knowledge Base Article

Getting started with kubectl commands [Self-hosted, Linux]

Welcome to the "Getting Started with kubectl Commands" guide. This article aims to provide a quick introduction to kubectl, the command-line tool for interacting with Kubernetes clusters, and walk you through some of the most common commands used in managing Sisense deployments on Kubernetes for both cloud-hosted and on-prem environments.

Step-by-Step Guide:

What kubectl does: Kubectl is a powerful command-line tool that allows users to interact with Kubernetes clusters. It provides commands for deploying applications, inspecting and managing cluster resources, and viewing logs. With kubectl, you can perform a wide range of operations to maintain and troubleshoot your Kubernetes environment.

Common kubectl Commands:

Change kubectl context to Sisense:

Command: 

kubectl config set-context default --namespace=sisense

Explanation: This command sets the current context to use the Sisense namespace by default. Contexts in Kubernetes allow you to switch between different clusters and namespaces easily.

Command:

kubectl config view

Explanation: Displays the current Kubernetes configuration, including contexts, clusters, and user settings. This command is useful for verifying the current context and ensuring that changes made with kubectl config set-context are correctly applied.

 

 

Get Nodes:

Command: 

kubectl get nodes -o wide

Explanation: This command lists all nodes in the cluster with additional details such as IP addresses and node roles. It helps you understand the physical or virtual machines that make up your cluster.

 

Describe Nodes:

Command: 

kubectl describe nodes

Explanation: Provides detailed information about each node, including resource usage, labels, and conditions. This is useful for diagnosing issues related to node performance or configuration.

 

 

Get Pods:

Command: 

kubectl get pods

Explanation: Lists all pods in the current namespace. Pods are the smallest deployable units in Kubernetes, consisting of one or more containers.

 

 

Describe a Specific Pod:

Command: 

kubectl describe pod <pod-name>

Explanation: Offers detailed information about a specific pod, including its status, events, and container details. This is useful for troubleshooting pod-specific issues.

 

 

Get Deployments:

Command:

 kubectl get deployments.apps

Explanation: Lists all deployments in the current namespace. Deployments manage the desired state of pods and ensure they are running correctly.

 

 

Get StatefulSets:

Command: 

kubectl get statefulset

Explanation: Lists all StatefulSets, which manage stateful applications requiring stable network identities and persistent storage.

 

 

Get Pod Logs:

Command: 

kubectl logs <pod-name>

Explanation: Retrieves logs from a specific pod, which is useful for debugging and monitoring application behavior.

 

 

Delete a Pod:

Command: kubectl delete pod <pod-name>

Explanation: Deletes a specific pod from the cluster. Disclaimer: It's not recommended to delete pods without extreme necessity, as it can disrupt services and affect application availability.

 

 

Difference Between Pods, Deployments, Replicas, and StatefulSets:

Pod: The basic unit of deployment in Kubernetes, consisting of one or more containers. Deployment: Manages the desired state of pods, allowing for updates and scaling. ReplicaSet: Ensures a specified number of pod replicas are running at any given time. StatefulSet: Manages stateful applications, providing stable identities and persistent storage.

Conclusion: 

Mastering kubectl commands is essential for efficiently managing Kubernetes clusters, especially when deploying complex applications like Sisense. This guide has introduced you to a selection of fundamental commands that form the backbone of Kubernetes operations. By understanding how to change contexts, view configurations, manage nodes, pods, and deployments, you gain the ability to navigate and control your Kubernetes environment with confidence.

As you continue to explore Kubernetes, remember that these commands are just the beginning. Kubernetes offers a vast array of functionalities that can be tailored to meet the specific needs of your applications. Regular practice and exploration of additional kubectl commands will deepen your expertise and enhance your ability to troubleshoot and optimize your deployments.

We encourage you to engage with the Sisense community, share your experiences, and learn from others. Whether you're resolving issues or implementing new features, collaboration and knowledge sharing are key to success in the dynamic world of Kubernetes.

References/Related Content 

Please refer to the official Kubernetes documentation for more details and other commands available: 

https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands

Disclaimer: This post outlines a potential custom workaround for a specific use case or provides instructions regarding a specific task. The solution may not work in all scenarios or Sisense versions, so we strongly recommend testing it in your environment before deployment. If you need further assistance with this, please let us know.

Published 06-23-2025
No CommentsBe the first to comment