Can I configure DO kubernetes on my DO server?

Posted June 16, 2020 1k views

I have setup a DO server and a Kubernetes.I have kubectl and doctl downloaded and the config file in in place. However, when I try: kubectl cluster-info I always get an error stating that connection to localhost:8080 was refused. Can anybody sort me out?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there @RSrsRsrS,

Yes, this is doable, I have the same setup at my end as well.

You could either use the doctl command to save your Kubernetes configuration file:

  • doctl kubernetes cluster kubeconfig save use_your_cluster_name

This downloads the kubeconfig for the cluster, merge it with any existing configuration from ~/.kube/config, and automatically handles the authentication token or certificate.

Another option would be to manually download the config file via your DigitalOcean control panel and upload it to your Droplet. Then you could use the following command to interact with the Kubernetes API:

  • kubectl --kubeconfig="use_your_kubeconfig.yaml" get nodes

For more information I would recommend taking a look at the official documentation here:

Hope that this helps!

  • Hi @bobbyiliev,
    Thank you very much for your reply. However, this does not seem to be the solution. The error continues to come. I had inititally installed kubectl and doctl through different installing packages. How probable is that this is the cause?


    • Hi there @RSrsRsrS,

      This could be due to kubectl using the incorrect context. You could check that by running the following command:

      • kubectl config get-contexts

      The output would look like this:

      CURRENT   NAME                         CLUSTER                      AUTHINFO                         NAMESPACE
      *         do-sfo2-example-cluster-01   do-sfo2-example-cluster-01   do-sfo2-example-cluster-01-admin

      If the selected one is not correct, you could change it with the following command:

      • kubectl config use-context the_name_of_your_cluster

      Let me know how it goes!