I’m encountering an issue with kubectl
that I’ve been struggling to resolve. When I attempt to run kubectl version
, I consistently receive the error message “The connection to the server localhost:8080 was refused - did you specify the right host or port?”
Here’s some context about my setup:
- I’m trying to connect to a Kubernetes cluster hosted on AWS EKS.
- I’ve verified that my
~/.kube/config
file contains the correct server URL, certificate authority data, and context for the cluster.
Despite double-checking my configuration and trying various troubleshooting steps, such as manually testing the connection with curl
and running kubectl
commands with verbose output, I haven’t been able to resolve the issue.
Has anyone encountered a similar problem before or have any insights into what might be causing this error? I would greatly appreciate any guidance or suggestions for troubleshooting steps to try next.
Cluster information:
1 Answer
Sorted by:
0
This is the output of the .kube/config
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQ>
server: https://73151AEE188E2A4D776D2E92C66C5B9F.gr7.eu-west-2.eks.amazonaws.com
name: arn:aws:eks:eu-west-2:448568155388:cluster/django-k8s-cluster
contexts:
- context:
cluster: arn:aws:eks:eu-west-2:448568155388:cluster/django-k8s-cluster
user: arn:aws:eks:eu-west-2:448568155388:cluster/django-k8s-cluster
name: arn:aws:eks:eu-west-2:448568155388:cluster/django-k8s-cluster
kind: Config
preferences: {}
users:
- name: arn:aws:eks:eu-west-2:448568155388:cluster/django-k8s-cluster
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
args:
- --region
- eu-west-2
- eks
- get-token
- --cluster-name
- django-k8s-cluster
- --output
- json
command: aws
env: null
interactiveMode: IfAvailable
provideClusterInfo: false
Kubernetes version:
Client Version: v1.29.0-eks-5e0fdde
Cloud being used:
AWS
Installation method:
EKS (Elastic Kubernetes Service)
Host OS:
Debian Linux