0
0
Kubernetesdevops~5 mins

What is Kubernetes - CLI Guide

Choose your learning style9 modes available
Introduction
Kubernetes helps you run and manage many software containers across multiple computers. It solves the problem of keeping your apps running smoothly even if some computers fail or need updates.
When you want to run your app on many computers to handle more users without crashing
When you need to update your app without stopping it for users
When you want to automatically restart parts of your app if they stop working
When you want to easily move your app to a different computer or cloud service
When you want to manage many small parts of your app separately but still have them work together
Commands
Check the installed Kubernetes command-line tool version to ensure it is ready to use.
Terminal
kubectl version --client
Expected OutputExpected
Client Version: v1.27.3
Show information about the Kubernetes cluster you are connected to, confirming access and cluster status.
Terminal
kubectl cluster-info
Expected OutputExpected
Kubernetes control plane is running at https://127.0.0.1:6443 CoreDNS is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
List all the computers (nodes) in your Kubernetes cluster to see where your apps can run.
Terminal
kubectl get nodes
Expected OutputExpected
NAME STATUS ROLES AGE VERSION worker-node-1 Ready <none> 10d v1.27.3 worker-node-2 Ready <none> 10d v1.27.3
Key Concept

If you remember nothing else from this pattern, remember: Kubernetes helps you run and manage many app parts across many computers automatically and reliably.

Common Mistakes
Trying to use Kubernetes commands without a running cluster or proper access.
Commands fail because there is no cluster to talk to or you lack permission.
Set up a Kubernetes cluster first or configure access to an existing one before running commands.
Confusing Kubernetes nodes with containers or pods.
Nodes are the computers, while pods are the app parts running inside containers on those nodes.
Learn the difference: nodes are machines, pods are groups of containers running your app.
Summary
Kubernetes manages app containers across many computers to keep apps running smoothly.
Use kubectl commands to check your tool version, cluster info, and nodes in the cluster.
Kubernetes helps apps update, recover, and scale automatically without manual intervention.