Kubernetes: kubectl not respecting $KUBECONFIG setting?

Created on 2 Jul 2015  ·  1Comment  ·  Source: kubernetes/kubernetes

I'm trying to lean more heavily on using KUBECONFIG instead of the default, but it doesn't seem to be working as an environment variable:

#
$ cluster/kubectl.sh config view --kubeconfig="/Users/me/.kube/gce"
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: REDACTED
    server: https://104.154.55.112
  name: linear-pointer-51831_kubernetes
contexts:
- context:
    cluster: linear-pointer-51831_kubernetes
    user: linear-pointer-51831_kubernetes
  name: linear-pointer-51831_kubernetes
current-context: linear-pointer-51831_kubernetes
kind: Config
preferences: {}
users:
- name: linear-pointer-51831_kubernetes
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED
    token: REDACTED
- name: linear-pointer-51831_kubernetes-basic-auth
  user:
    password: <password>
    username: admin

#
$ KUBECONFIG="/Users/me/.kube/gce"

#
$ echo $KUBECONFIG
/Users/me/.kube/gce

#
$ cluster/kubectl.sh config view
apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []

#
$ cluster/kubectl.sh get po --kubeconfig="/Users/me/.kube/gce"
NAME                                           READY     REASON    RESTARTS   AGE
fluentd-cloud-logging-kubernetes-minion-4zgf   1/1       Running   0          1d
fluentd-cloud-logging-kubernetes-minion-8w6v   1/1       Running   0          1d
fluentd-cloud-logging-kubernetes-minion-lhom   1/1       Running   0          1d
fluentd-cloud-logging-kubernetes-minion-tr0n   1/1       Running   0          1d
kube-dns-v4-f7mdy                              3/3       Running   0          1d
monitoring-heapster-v4-t2iru                   1/1       Running   0          1d
monitoring-influx-grafana-v1-srtjm             2/2       Running   0          1d

#

Am I doing something wrong?

Most helpful comment

Sigh. Didn't realize that kubectl started a new shell, and needed to export KUBECONFIG.

>All comments

Sigh. Didn't realize that kubectl started a new shell, and needed to export KUBECONFIG.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

theothermike picture theothermike  ·  3Comments

tbchj picture tbchj  ·  3Comments

ttripp picture ttripp  ·  3Comments

arun-gupta picture arun-gupta  ·  3Comments

rhohubbuild picture rhohubbuild  ·  3Comments