Closed wcamellia closed 1 year ago
What's the error message your program outputs ?
Is your program running out of kube cluster or in cluster ?
And do you configure the right kubernetes config (if your program runs out of kube cluster) ?
~/.kube/config
in your home directoryKUBECONFIG
configFileName
of load_kube_config
my k8s cluster deploy in "root" user, but i change into "admin" user , when i uese the c api in the non-root user,The error message my program outputs: "kubeyaml_load_kubeconfig(): Cannot open the file /root/.kube/config.[Permission denied] load_kube_config(): Cannot load the kubeconfig /root/.kube/config Cannot load kubernetes configuration."
Option 1:
cp /root/.kube/config /some/location/where/non-root/user/can/read/config
export KUBECONFIG=/some/location/where/non-root/user/can/read/config
# run your program
Option 2:
int rc = load_kube_config(&basePath, &sslConfig, &apiKeys, "/some/location/where/non-root/user/can/read/config");
Option 3:
mkdir ~admin/.kube
cp /root/.kube/config ~admin/.kube/
I prefer the option 3.
ok !thank you very much
Closing since the question is answered.
How to set up a non-root user, to use the C API or k8s? my "C api" and "k8s" can not work under the non-root user