
- KUBECTL GET CONTEXTS HOW TO
- KUBECTL GET CONTEXTS INSTALL
- KUBECTL GET CONTEXTS UPDATE
- KUBECTL GET CONTEXTS FULL
- KUBECTL GET CONTEXTS CODE
Kubectl run pi -image =perl -restart =OnFailure - perl -Mbignum =bpi -wle 'print bpi(2000)' # Start the cron job to compute π to 2000 places and print it out every 5 minutes. # Start the perl container to compute π to 2000 places and print it out. Kubectl run nginx -image =nginx -command. # Start the nginx container using a different command and custom arguments. # Start the nginx container using the default command, but use custom arguments (arg1. Kubectl run -i -t busybox -image =busybox -restart =Never
KUBECTL GET CONTEXTS CODE
# Load the kubectl completion code for zsh into the current shell source " $' # Start a pod of busybox and keep it in the foreground, don't restart it if it exits. # Installing bash completion on Linux # Load the kubectl completion code for bash into the current shell source ~/.kube/ Kubectl completion bash > $(brew -prefix )/etc/bash_completion.d/kubectl # If you've installed via other means, you may need add the completion to your completion directory
KUBECTL GET CONTEXTS INSTALL
Kubectl create -f filename.# Installing bash completion on macOS using homebrew # If running Bash 3.2 included with macOSīrew install If kubectl is installed via homebrew, this should start working immediately. Kubectl rollout undo deployment/helloworld

Kubectl rollout history deployment/helloworld Kubectl set image deployment/helloworld helloworld=igorski/helloworld:latest Kubectl expose deployment helloworld -type=NodePort Other Commands kubectl label pod/helloworld app=helloworld -overwrite Troubleshooting commands #Get information about resource usage by cluster nodes

With two clusters, it would look something like: apiVersion: v1 Kubectl config use-context my-cluster-nameĬontexts are configured in the ~/.kube/config file. Kubectl will run all the commands against the currently configured context. A context element in a kubeconfig file is used to group access parameters under a convenient name. K8S uses contexts in order to ease the access to different clusters. Those could be your local cluster on your development machine or different deployment environments like testing, staging or production. Sometimes need to work with multiple clusters. Kubectl describe po helloworld -n hello -o yml Context commands # When describing a specific pod the -all-namespaces flag won't work. # Describe the pod named helloworld in the default namespaces. Kubectl get po helloworld -n hello -o json #Get pods with output in the given format. Kubectl get pods -l 'release-version not in (1.0,2.0)' -show-labels Kubectl get pods -selector app!=helloworrld,env=staging In the following set of commands I use pods but you can replace pods with a different resource type, like services, and the commands would still work. General Commands #List all resources in all namespaces These commands you can use with any type of resource, regardless if that is pods, deployments, services or any other type. delete: Delete resources by filenames, stdin, resources and names, or by resources and label selector.explain: show information about the resource.Kubernetes has a few basic commands for managing resources:
KUBECTL GET CONTEXTS UPDATE
They help to automate the update procedures that would otherwise require many tedious and error prone manual steps. Deploymentsĭeployments allow you to describe the lifecycle of an application like which images to use, the number of pods that should exist and the way they should be upgraded. The most often used container runtime is Docker. The kubelet process is by the Mater node to communicate to the node. Each node runs at least a kubelet instance and a container runtime. Nodes can be physical or virtual machines.
KUBECTL GET CONTEXTS HOW TO
Pods are the smallest deployable units of computing that you can create and manage in Kubernetes.Ī Pod is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers.
KUBECTL GET CONTEXTS FULL
In commands you can use either the full resource name or the short name. But most commonly you will probably need to use the following few: Resouce

There is a long list of Kubernetes resource types. I do it primarily for myself but if I am able to help at least someone else out there, I would be extremely happy. I will keep adding commands and re-organizing sections as this list grows. It contains commands I use most often while working with K8S. This is my kubectl cheat sheet for Kubernetes.
