OpenShift - Resolve "Missing or incomplete configuration info. Please point to an existing, complete config file"

by
Jeremy Canfield |
Updated: January 06 2023
| OpenShift articles
Let's say something like this is being returned.
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.
This typically occurs when attempting to log into OpenShift. The error suggests that your /home/username/.kube/config file is missing or incomplete.
If the /home/your_username/.kube/config file does not exist, it will be created after the first successful log in.
oc login --username john.doe api.openshift.example.com:6443
Here is an example of what your /home/username/.kube/config file might look like.
apiVersion: v1
clusters:
- cluster:
server: https://api.openshift.example.com:6443
name: os.example.com:6443
contexts:
- context:
cluster: api.openshift.example.com:6443
namespace: default
user: john.doe
name: default/api.openshift.example.com:6443/john.doe
current-context: default/api.openshift.example.com:6443/john.doe
kind: Config
preferences: {}
users:
- name: john.doe
user:
token: Mn8cvscRkYgEUo_DcoUHUk3Z7Cu8W2RQikRBwmglet8
As the error suggests, one option is to use the --kubeconfig option.
oc login api.openshift.example.com:6443 --kubeconfig /home/john.doe/.kube/config
Or you could use the export command to set the KUBECONFIG environment variable. Or you could add this command to /home/username/.bash_profile to make this a permanent environment variable.
export KUBECONFIG=/home/username/.kube/config
Did you find this article helpful?
If so, consider buying me a coffee over at
Comments
April 19 2024 by Madhu
cmd: oc login --username john.doe api.openshift.example.com:6443 gives an error as below.
error: dial tcp: lookup api.openshift.example.com: no such host - verify you have provided the correct host and port and that the server is currently running.
April 19 2024 by Jeremy (moderator)
john.doe and api.openshift.example.com:6443 are example ID and URI, you'll replace john.doe and api.openshift.example.com:6443 with your actual ID and URI