.kube config: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 8: Line 8:
<tt>$HOME/.kube/config</tt> is <tt>[[Kubectl#Configuration|kubectl]]</tt> configuration file. It contains definitions for [[#Cluster|clusters]], [[#User|users]] and [[#Contexts|contexts]]. The content of the file can be displayed with:
<tt>$HOME/.kube/config</tt> is <tt>[[Kubectl#Configuration|kubectl]]</tt> configuration file. It contains definitions for [[#Cluster|clusters]], [[#User|users]] and [[#Contexts|contexts]]. The content of the file can be displayed with:


  [[Kubectl_config#view|kubectl config view]]
  kubectl [[Kubectl_config#view|config view]]


=Clusters=
=Clusters=

Revision as of 00:14, 22 August 2019

Internal

Overview

$HOME/.kube/config is kubectl configuration file. It contains definitions for clusters, users and contexts. The content of the file can be displayed with:

kubectl config view

Clusters

The section contains the definition of one or more clusters. Each cluster definition has a name, certificate info and the API server's endpoint.

clusters:
- cluster:
    certificate-authority-data: LS0tLS1...tLQo=
    server: https://kubernetes.docker.internal:6443
  name: docker-desktop

Users

This section contain definitions of users that might have different levels of permissions for each cluster. Each user definition has a friendly name, a username and a set of credentials.

users:
- name: docker-desktop
  user:
    client-certificate-data: LS0tL...LS0K
    client-key-data: LS0tL...tLQo=

Contexts

Contexts bring together clusters and users under a friendly name.

current-context: docker-desktop
contexts:
- context:
    cluster: docker-desktop
    user: docker-desktop
  name: docker-desktop

Current Context

The current context can be viewed with

kubectl config current-context