Questions tagged [kubeconfig]

105 questions
2
votes
3 answers

How can I use an alternative kubeconfig file?

By default, kubectl configuration is located at ~/.kube/config. Is it possible to specify the kubeconfig file explicitly when using the kubectl command?
zjffdu
  • 25,496
  • 45
  • 109
  • 159
2
votes
1 answer

How do I interpolate Kubernetes variables into JSON in the ConfigMap YAML file?

I have this ConfigMap where I am constructing a app-config.json file that I pass into Angular. This file is how I get environment variables into Angular as they must be served. Below is how I thought passing variables into the JSON would work in…
2
votes
1 answer

rendering env-var inside kubernetes kubeconfig yaml file

I need to use an environment variable inside my kubeconfig file to point the NODE_IP of the Kubernetes API server. My config is: apiVersion: v1 clusters: - cluster: insecure-skip-tls-verify: true server: https://$NODE_IP:6443 name:…
oguz
  • 514
  • 4
  • 9
2
votes
1 answer

How can you use the kubectl tool (in a stateful/local way) for multiple managing multiple clusters from different directories simultaneously?

Is there a way you can run kubectl in a 'session' such that it gets its kubeconfig from a local directory rather then from ~/.kubeconfig? Example Use Case Given the abstract nature of the question, it's worth describing why this may be valuable in…
jayunit100
  • 17,388
  • 22
  • 92
  • 167
1
vote
0 answers

kubectl get node is returning connection refused

When I add this command: sudo kubectl get node --kubeconfig /etc/kubernetes/admin.conf I got NAME STATUS ROLES AGE VERSION master NotReady control-plane 42m v1.26.1 but when I send: sudo kubectl get node I got E0126…
Ali Shehab
  • 23
  • 3
1
vote
0 answers

Access to eks cluster with Lens issue

I'm facing a problem whith Lens access to eks around 2 months ago. I think I tried a lot of solutions but nothing is working for me. I'm accessing to eks fine on wsl Ubuntu with AWS credentials. I Installed the last version of Lens put the…
1
vote
1 answer

How to switch kubernetes contexts dynamically with client-go?

I'm building a CLI application that would allow me to run an arbitrary command in my shell against any kube cluster in my kubeconfig that matches a given regex. I want to use the official client-go package to accomplish this, but for some reason,…
Matanya
  • 183
  • 1
  • 9
1
vote
0 answers

How can I extend the kubeconfig in EKS?

The Problem AWS EKS runs a bootstrap script that reads arguments and environment information to write a kubeconfig file before starting kubelet. I want to change a bit of the garbage collection by setting a custom eviction hard policy (as described…
rayepps
  • 2,072
  • 1
  • 12
  • 22
1
vote
3 answers

kubectl command for talking to multiple physical clusters

This is my ~/.kube/config file: apiVersion: v1 clusters: - cluster: server: https://192.168.10.190:6443 name: cluster-1 - cluster: server: https://192.168.99.101:8443 name: cluster-2 contexts: - context: cluster: cluster-1 user:…
overexchange
  • 15,768
  • 30
  • 152
  • 347
1
vote
0 answers

Merge kubectl config into ~/.kube/config

To use kubectl(to talk to kubernetes api-server) with merged config, below two commands can be used to merge kubeConfig: KUBECONFIG=~/.kube/config:/path/to/another/config.yml kubectl config view --flatten > ~/.kube/config-new.yaml and then cp…
overexchange
  • 15,768
  • 30
  • 152
  • 347
1
vote
1 answer

'config_path' refers to an invalid path: "kubeconfig": stat kubeconfig: no such file or directory

We are running a terraform to create a GKE Cluster and using the below to create a local kubeconfig file after the creation of the cluster. module "gke_auth" { source = "terraform-google-modules/kubernetes-engine/google//modules/auth" depends_on…
Nitin G
  • 714
  • 7
  • 31
1
vote
1 answer

Authenticate to GKE cluster without setting GOOGLE_APPLICATION_CREDENTIALS environment variable

What is the best way to authenticate to a GKE cluster without actually setting env variables for GOOGLE_APPLICATION_CREDENTIALS or KUBECONFIG. I have an application running on a container which has to communicate with multiple GKE clusters at once.…
1
vote
1 answer

How to change the name of a user in kube config file with kubectl?

How do you change the name of a user in a kube config file with kubectl (no text editor)? Example kube config file stage_config.yaml: apiVersion: v1 clusters: - cluster: certificate-authority-data: REDACTED server: https://127.0.0.1:6443 …
SlyGuy
  • 127
  • 1
  • 3
  • 13
1
vote
0 answers

In Kubernetes new users have all permissions to do anything although they are not assigned any Roles or ClusterRoles

RBAC is enabled (checked with kubectl api-versions, and got rbac records in the output). So as I assume, the normal users that are not bound with any Roles and ClusterRoles should have the most limited access to the cluster. I create the…
1
vote
1 answer

How to use kubeconfig as environment variable in GitLab

I'm creating a GitLab CI/CD pipeline to deploy an application to Azure Kubernetes Services. How can I specify a kubeconfig file as environment variable? How can be used in the pipeline?
Salvatore Calla'
  • 113
  • 2
  • 16