This message was deleted.
# kubernetes
a
This message was deleted.
h
what kubernetes distribution? I have RKE and RKE2 and that works on both.
If you run:
Copy code
kubectl get no
kubectl get po
kubectl get ns
Does any of that work?
c
You need to run that directly against the cluster, not against the rancher proxy. If you use the kubeconfig that rancher gives you, the base urls are all different because you're going through rancher.
a
kubectl get no / po / ns are all work. for example: $ kubectl get ns NAME STATUS AGE cattle-impersonation-system Active 14d cattle-system Active 14d default Active 14d eic Active 14d ingress-nginx Active 14d kube-node-lease Active 14d kube-public Active 14d kube-system Active 14d local Active 14d (base)
@creamy-pencil-82913 how to find what I run against? I think I run against cluster, this is my kube config file: apiVersion: v1 kind: Config clusters: - name: “eig01” cluster: server: “https://10.131.116.250:9102/k8s/clusters/c-sd79w” certificate-authority-data: “” cluster: server: “https://10.131.116.250:6443” certificate-authority-data: “” users: - name: “eig01" user: token: “kubeconfig-user-l24vst5tld:6qv4z6jf2hqxjwxbnbdrj2fnfpg7hv27tzws8jc9lksqpv5dfpqnvq” contexts: - name: “eig01" context: user: “eig01” cluster: “eig01" - name: “eig01-cnsthana250” context: user: “eig01" cluster: “eig01-cnsthana250” current-context: “eig01" --------------- eig01 is cluster name
h
What Brandond is saying is you need kubeconfig file directly from the downsream cluster instead of the one you downloaded from Rancher UI. For example, on RKE2 cluster, you will find kubeconfig file here:
/etc/rancher/rke2/rke2.yaml
Again that is directly on the cluster you are trying to run kubectl against.
a
how can i find it? I install ranker by docker and there is no /etc/rancher folder. I search the disk there is no rke2.yaml file. please give me some suggestion. how to get “kubeconfig that rancher gives you” Thanks
h
okay - since you have RKE distribution, this should help: https://rke.docs.rancher.com/kubeconfig
When you deployed Kubernetes, a kubeconfig is automatically generated for your RKE cluster. This file is created and saved as
kube_config_cluster.yml
.
a
if I go to kubectl shell of rancher I can run the command: kubectl get --raw /livez?verbose correctly. the kubeconfig file in my kubeshell is like: cat .kube/config apiVersion: v1 clusters: - cluster: server: http://127.0.0.1:8001 name: cluster contexts: - context: cluster: cluster user: “” name: default current-context: default kind: Config preferences: {} users: null
So, you are right, I should use the wrong kubeconfig file, but I don’t know how to find the correct one 😞