DataStax Academy FAQ

DataStax Academy migrated to a new learning management system (LMS) in July 2020. We are also moving to a new Cassandra Certification process so there are changes to exam bookings, voucher system and issuing of certificates.

Check out the Academy FAQ pages for answers to your questions:


question

lukmanulhakim093 avatar image
lukmanulhakim093 asked ·

kubectl cluster-info can't connect to cluster, "No connection could be made because the target machine actively refused it"

Hi,

I learn how to create Kubernetes cluster from Developer Workshop - Kubernetes and Apache Cassandra APAC and already follow the instructions were given. When I try to run command kubectl cluster-info --context kind-kind-cassandra from this link https://github.com/lukmanulhakim093/kubernetes-workshop-online/tree/master/0-setup-your-cluster I got this error message below.

What should I do to solve this error?

Thanks,

Lukman

workshopkubernetes
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Cedrick Lunven avatar image
Cedrick Lunven answered ·

Hi, I have reproduced your issue:

kind get clusters
kind-cassandra

kubectl cluster-info dump
The connection to the server 127.0.0.1:45451 was refused - did you specify the right host or port?

Here how i fixed it:

1. Setup Docker-Desktop

https://kind.sigs.k8s.io/docs/user/quick-start/#settings-for-docker-desktop

2. Cleanup Kind and use last Kind version (0.8.1)

kind delete cluste
kind delete cluster --name kind-cassandra
kind get clusters

3. Reinstall the cluster

kind create cluster --name kind-cassandra --config ./0-setup-your-cluster/01-kind-config.yaml

4. Associate cluster

Make sure in Docker-desktop to pick the proper Kubernetes installation.


He is happy again

kubectl cluster-info --context kind-kind-cassandra
Kubernetes master is running at https://127.0.0.1:45451
KubeDNS is running at https://127.0.0.1:45451/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Erick Ramirez avatar image
Erick Ramirez answered ·

The error you reported is pretty generic. There are 2 possible issues I can think of off the top of my head but I don't have a Windows machine configured right now to be able to test so you'll need to do some investigation and troubleshooting yourself.

No cluster

There's a good chance that in step 6 of the setup instructions, you didn't manage to successfully create a KiND cluster.

If you don't have a cluster running, you won't be able to get any cluster information. You can test this by listing available contexts. If there are no context like in this example, it's confirmation that you don't have a cluster running:

$ kubectl config get-contexts
CURRENT   NAME   CLUSTER   AUTHINFO   NAMESPACE

If your cluster is running, you will see an output equivalent to this:

$ kubectl config get-contexts
CURRENT   NAME                  CLUSTER               AUTHINFO              NAMESPACE
*         kind-kind-cassandra   kind-kind-cassandra   kind-kind-cassandra

Go over the instructions again and verify that you haven't missed any steps.

No HOME variable

It is also possible for kubectl cluster-info to not work if the HOME environment variable is not set.

The kubectl command reads the configuration from the %HOME%/.kube/config file. If the configuration file is missing, kubectl commands can't work.

You will need to set the %HOME% environment variable in your Windows 10 system properties then try to create your cluster again. Cheers!

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Nice answer by Erick.

I would amend by asking you to also check your firewall at Windows level

It Is active ? Does it block the port 45451 by any chance ?

0 Likes 0 · ·

Hi @Erick Ramirez,

-The cluster is running.

-kubectl is working fine.

-but the docker using default machine IP 192.168.99.100.

-kubernetes master should running on https://127.0.0.1:45451.

What should I configure to solve this discrepancy?


Thanks.



0 Likes 0 · ·
get-config.png (2.7 KiB)
kubectl.png (7.0 KiB)
machine-host.png (2.4 KiB)