When running any kubectl
command from the command line on your Puppet Application Manager (PAM) control plane node, you get a The connection to the server localhost:8080 was refused
error.
Error messages and logs
When running kubectl get pods
as root on a Continuous Delivery for Puppet Enterprise control plane node, you get a The connection to the server localhost:8080 was refused - did you specify the right host or port?
error.
You can get this error if the KUBECONFIG
environment variable is not set or set incorrectly. The PAM Kubernetes cluster doesn’t communicate with port 8080, it uses either port 6443 or 6444. The error message mentions port 8080, which indicates a configuration issue with your root user profile in /etc/profile
.
Version and installation information
Product: Continuous Delivery for Puppet Enterprise
Version: 4.x
Solution
Use the following steps on the PAM control pane node to check if the KUBECONFIG
environment variable is present in the root user profile in /etc/profile
and if it is present, whether it is configured correctly .
-
To check that the root user profile has the
KUBECONFIG
variable pointing to/etc/kubernetes/admin.conf
, run:grep KUBECONFIG /etc/profile
The output should look similar to the following:
export KUBECONFIG=/etc/kubernetes/admin.conf
-
If
export KUBECONFIG
is not present, or it is not pointing to/etc/kubernetes/admin.conf
, use a text editor, likevi
, to correct it. To load the change without restarting the shell, runsource /etc/profile
. -
To check that the
KUBECONFIG
variable has aserver:
setting that points to either port 6443 or 6444 (either is correct), run:grep server /etc/kubernetes/admin.conf
The output should look similar to the following:
server: https://localhost:6444
orserver: https://<CONTROL PLANE NODE IP ADDRESS>:6444
-
If
/etc/kubernetes/admin.conf
is not set to 6443 or 6444, use a text editor, likevi
, to correct it.
How can we improve this article?
0 comments
Please sign in to leave a comment.
Related articles