Kubectl config: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 28: Line 28:
This procedure is useful if we install kubectl only on a remote client machine and we need it to configure it to connect to a Kubernetes cluster.
This procedure is useful if we install kubectl only on a remote client machine and we need it to configure it to connect to a Kubernetes cluster.


  ./kubectl config set-cluster test  --server=https://10.10.2.87 --certificate-authority=~/tmp/kubespray/kubespray-2.11.0/inventory/playground/credentials/kubeadm_certificate_key.creds
  ./kubectl config set-cluster test  --server=https://10.10.2.87 --certificate-authority=~/tmp/kubespray/kubespray-2.11.0/inventory/playground/credentials/kubeadm_certificate_key.creds


Configure context and user
Configure context and user

Revision as of 06:01, 28 November 2019

Internal

Overview

current-context

Displays the current context:

kubectl config current-context

use-context

Sets the current context:

kubectl config use-context new-context-name

view

Displays the content of ~/.kube/cofig:

kubectl config view

Creating a Context from Scratch

This procedure is useful if we install kubectl only on a remote client machine and we need it to configure it to connect to a Kubernetes cluster.

./kubectl config set-cluster test  --server=https://10.10.2.87 --certificate-authority=~/tmp/kubespray/kubespray-2.11.0/inventory/playground/credentials/kubeadm_certificate_key.creds

Configure context and user

./kubectl config use-context test

TBC