I am trying to follow steps from
ref URL: Secrets-Kubernetes to create a Secret Using kubectl,
I was able to create files
- username.txt
- password.txt
which show under pwd
[root@1161 cdp]# ls
password.txt username.txt
and now when I try to execute the next statement which is
kubectl create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt
I get following error:
error: Missing or incomplete configuration info. Please point to an existing, complete config file:
1. Via the command-line flag --kubeconfig
2. Via the KUBECONFIG environment variable
3. In your home directory as ~/.kube/config
To view or setup config directly use the 'config' command.
Note: I’m running the statement behind corporate proxy, Please advise on how to proceed further
This is on centos 7
kubectl version --client
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.2",
GitCommit:"52c56ce7a8272c798dbc29846288d7cd9fbae032", GitTreeState:"clean",
BuildDate:"2020-04-16T11:56:40Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Best Regards,
MK
5
Answers
I had to create a config file manually and then set KUBECONFIG env by doing
My_Config file
apiVersion: v1 clusters: - cluster: api-version: v1 server: "my-server" insecure-skip-tls-verify: true name: default-cluster contexts: - context: cluster: default-cluster namespace: "my-namespace" user: default-user name: default-context current-context: default-context kind: Config users: - name: default-user user: token: "my-token"
Thanks all for your support, Appreciate it!
Have you tried creating the secret files one at a time. For example this works for me
Please check if you have setup the Kubectl config credentials correctly.
You can fetch the credentials like below:
For google:
For AWS:
Can you please do
kubectl config current-context
? Wondering if you already authenticated on the right cluster or not. If not you have to option whether directly passing the file kubeconfig each time you call the command or set it one time.Try setting the KUBECONFIG env manually.