Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 1.65 KB

File metadata and controls

68 lines (47 loc) · 1.65 KB

KubeConfig

In this section, we will take a look at kubeconfig in kubernetes

Client uses the certificate file and key to query the kubernetes Rest API for a list of pods using curl.

  • You can specify the same using kubectl

    kc1

  • We can move these information to a configuration file called kubeconfig. And the specify this file as the kubeconfig option in the command.

    $ kubectl get pods --kubeconfig config
    

Kubeconfig File

  • The kubeconfig file has 3 sections

    • Clusters
    • Contexts
    • USers

    kc4

    kc5

  • To view the current file being used

    $ kubectl config view
    
  • You can specify the kubeconfig file with kubectl config view with "--kubeconfig" flag

    $ kubectl config veiw --kubeconfig=my-custom-config
    

    kc6

  • How do you update your current context? Or change the current context

    $ kubectl config use-context <context-name>
    ex: 
    $ kubectl config use-context prod-user@production
    

    kc7

  • kubectl config help

    $ kubectl config -h
    

    kc8

What about namespaces?

kc9

Certificates in kubeconfig

kc10

kc12

kc11

K8s Reference Docs