Kubernetes CLI: kubectl

kubectl is the command line interface for Kubernetes.

Basic kubectl commands

CommandDescription
kubectl get podsList all pods
kubectl cluster-infoDisplay cluster information
kubectl get allList all resources: Pods, deployments, services, etc.
kubectl run [container-name] --image=[image-name]Create a deployment for a pod
kubectl port-forward [pod-name] [port-number]Forward a port to a pod to allow external access
kubectl create [resource]Create a resource
kubectl apply [resource]Create or update resource

Useful Aliases for kubectl

A common practice for kubectl is to alias it to k for convenience.

To alias kubectl to k in PowerShell:

Set-Alias -Name k -Value kubectl

To alias kubectl to k in bash:

alias k="kubectl"

You can test the alias by running k version.

Broader Topics Related to Kubernetes CLI: kubectl

Kubernetes (k8s)

Kubernetes (k8s)

A system to conduct an orchestra of containers

Command-line Interfaces (CLI)

Command-line Interfaces (CLI)

Programs that take commands through terminals and shells

Kubernetes CLI: kubectl Knowledge Graph