Cloud9 Kubernetes issue

0

I'm trying to study Kubernetes and I'm running into issues with my Cloud9 environment. When I try to run the following command, it returns this error: kubectl version Client Version: v1.29.0 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3 The connection to the server localhost:8080 was refused - did you specify the right host or port?

I've tried reinstalling and configuring the admin.conf file, but can't find where it currently resides. Any kubectl command I try to run, I get this error. I don't currently have any clusters setup, nor can I create one due to this error. Any tips would be greatly appreciated. (Maybe rebuild a different Cloud9 environment?)

Thanks Dan

asked 6 months ago466 views
2 Answers
0
Accepted Answer

Thank you so much for the response. This at least pointed me in the right direction. After trying to go through those steps, I found that my config.yaml file had been over written somehow. Once I got that squared away, then everything started working as expected.

Thanks again for the help.

Dan

answered 6 months ago
0

Hello,

When you run kubectl version command, it shows you the client version i.e. kubectl binary version, and tries to connect to the kubernetes cluster in order to get the server version. In your case, since you do not have a running cluster configured in your kubeconfig file (~/.kube/config), it is trying the default kubernetes cluster port on your Cloud9 Environment at localhost:8080.

If you already have an EKS cluster running, you can run the below update-kubeconfig command to automatically set the kubeconfig file on your Cloud9 Environment.

aws eks update-kubeconfig --name <cluster-name> --region <aws-region>

If you wish to create a new EKS cluster for learning purpose, you can follow the below steps:

  1. Install EKSCTL CLI on your Cloud9 Environment by following this doc: https://eksctl.io/installation/#for-unix

  2. Create an EKS cluster using the below command:

    Note: For customized settings, follow this doc: https://eksctl.io/usage/creating-and-managing-clusters/

    eksctl create cluster --name <desired-cluster-name> --region <aws-region>
    
  3. The above command should automatically set the kubeconfig file at ~/.kube/config on your Cloud9 Environment after a successful execution. If not, you can run the update-kubeconfig command that I mentioned in earlier section.

  4. Once you are finished with it, you can delete the cluster using the below command:

    eksctl delete cluster --name <cluster-name> --region <aws-region>
    

I highly recommend you to go through the EKS Workshop that contains hands-on tutorials to help you get familiarized with EKS.

I hope this helps!

profile pictureAWS
SUPPORT ENGINEER
answered 6 months ago
profile picture
EXPERT
reviewed 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions