kubeconfig
kubeconfig is the file that permits to connect to a Kubernetes cluster.
Structure
Section titled “Structure”Example
apiVersion: v1kind: Configclusters: - cluster: certificate-authority-data: LS0tL server: https://x.x.x.x:6443 name: cluster-namecontexts: - context: cluster: cluster-name user: default name: default@cluster-namecurrent-context: default@cluster-nameusers: - name: default user: client-certificate-data: LS0tLS... client-key-data: LS0t...It contains:
- cluster information
- user information
- and context (a pair of cluster and user information)
Context
Section titled “Context”The context is the pair user / cluster that is used to connect.
Order of Precedence
Section titled “Order of Precedence”Kubee search the kubeconfig file in the following order:
- the
KUBECONFIGenv - the default kubeconfig file
~/.kube/config - in the pass at
$KUBEE_PASS_HOME/kubeconfig/$KUBEE_CONTEXT_NAME
Context check for cluster connection
Section titled “Context check for cluster connection”To be sure that the command are executed against the required cluster, kubee checks that the kubeconfig current context is equal to the KUBEE_CONTEXT_NAME.
ie the expected value should be:
apiVersion: v1kind: Configclusters: [ ]contexts: [ ]users: [ ]current-context: "$KUBEE_CONTEXT_NAME"If it’s not the case, it will try to change it and if it does not succeed, it will exit.
How To
Section titled “How To”How to see the kubeconfig file
Section titled “How to see the kubeconfig file”# with the cert cachedkubee kubectl config view# with all datakubee kubectl config view --rawHow to test a connection
Section titled “How to test a connection”kubee kubectl cluster-infoHow to encrypt
Section titled “How to encrypt”We allow also to store in encrypted with pass
How to use ODIC as user to login
Section titled “How to use ODIC as user to login”You can also define the user as an oidc login.
Check the runbook: configure oidc with kubelogin.