/
Merging Kubernetes kubectl config files

Merging Kubernetes kubectl config files

  • To run a kubernetes cluster check whether the path of that cluster should be present in “~/ .kube/config” folder.If not there, we need to add the path of the cluster to that folder.

  • To check whether the path is present in “~/ .kube/config” folder.

$ echo $KUBECONFIG
  • If path is absent follow the below commands:

  • $ export KUBECONFIG=~/.kube/config:PATH OF THE CLUSTER $ kubectl config view --flatten >> ~/.kube/config $ echo $KUBECONFIG
  • To display the cluster contexts

$ kubectl config get-contexts
  • Sometimes when working with a new Kubernetes cluster you will be given a config file to use when authenticating with the cluster. This file should be placed at ~/.kube/config. However you may already have an existing config file at that location and you need to merge them together.

  • To merge the config files in “~/ .kube/config” follow the below steps:

  • It will create a backup file for existing config file.

consider eks_gowtham_eks = path1

eks_Gowtham_cicd = path2

  • Add those paths using following command

  • After adding the paths check they had added or not

  • If you want to switch the contexts

  • Finally check whether all the pods are running.

 

Related content

Git Repository Splitting
Git Repository Splitting
Read with this
Kubectl Installation and Setup Guide
Kubectl Installation and Setup Guide
More like this
How-to articles
How-to articles
Read with this
EKS Rolling Upgrade
EKS Rolling Upgrade
More like this
How to configure SOPs
How to configure SOPs
Read with this
Kubernetes Cheat sheet commands
Kubernetes Cheat sheet commands
More like this