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

已提問 6 個月前檢視次數 455 次
2 個答案
0
已接受的答案

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

已回答 5 個月前
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
支援工程師
已回答 6 個月前
profile picture
專家
已審閱 5 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南