kubectl command is used to manage Kubernetes Clusters.

To install kubectl on Linux, run

On Ubuntu, you can install from snap using

or with apt

To get help, run

Check if Kubernetes environment is ready

Run nginx container

Connect to a pod

Execute a command in pod

Change image used by a pod

Scale a deployment

Expose a port

Port forward

Some useful commands

kubectl get no
kubectl get nodes
List all available nodes
kubectl get po
kubectl get pods
List all available pods
kubectl get services
kubectl get svc
List all available services
kubectl get deployments List all deployments
kubectl config current-context Shows with cluster kubectl is connected to.
kubectl cluster-info Shows info on current cluster.
kubectl scale deployment DEPLOYMENT_NAME –replicas 4 Scale a deployment to 4 replicas.
kubectl create ns production Create namespace “production”
kubectl -n kube-system create sa tiller Create tiller account for helm
kubectl delete all –all delete all resources in cluster

See Kubernetes

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *