Kubectl

From Bonus Bits
Jump to: navigation, search

Description

This article gives references to useful syntax related to Kubernetes CLI command kubectl.

Configure

Local Configuration Location

Default kubeconfig is in the following location. The path is set with the KUBECONFIG environment variable or by using the --kubeconfig <file path> argument with kubectl command.

$HOME/.kube/config

View Full Configuration

kubectl config view

Display Current Context

kubectl config current-context

Switch Context

kubectl config use-context <context name>

Create Context

kubectl config set-context <context name>

Delete Context

kubectl config delete-context <context name>

Display Clusters

kubectl config get-clusters

Create Cluster

kubectl config set-cluster <cluster name>

Delete Cluster

kubectl config delete-cluster <cluster name>

Remove User

kubectl config unset users.<user name>

Set Individual Value in Kubeconfig File

kubectl config set PROPERTY_NAME PROPERTY_VALUE [options]


Run Config

kubectl run -f https://k8s.io/examples/application/deployment.yaml


Subject

formatted text
cat /var/log/messages

Icon-Tip-Square-Green.png
Gnome-sticky-notes-applet


Related Articles


Sources