kubernetes is running but not listing the worker node - kubernetes

I have setup kubernetes cluster in my ubuntu machine, before it was working
then I have restart the machine, it's not working now properly.
I am getting the following error.
root#master:~# kubectl get nodes
The connection to the server 192...*:6443 was refused - did you specify the right host or port?
root#master:~#

Can you explain how you installed kubernetes? For instance are you using minikube?
perhaps you just need to start minikube?
minikube start
This takes a few minutes to start up so be patient
An alternative cause is that your IP may have changed. does ip addr match the ip its trying to connect to. If it doesn't you may need to edit your ~/kube/config file
Is anything listening on port 6443?
netstat -pant | grep 6443`

Related

How to make two local minikube clusters communicate with each other?

I have two minikube clusters(two separate profiles) running locally call it minikube cluster A and minikube Cluster B. Each of these cluster also have an ingress and a dns associated with it locally. The dns are hello.dnsa and hello.dnsb . I am able to do ping on both of them and nslookup just like this https://minikube.sigs.k8s.io/docs/handbook/addons/ingress-dns/#testing
I want pod A in cluster A to be able to communicate with pod B in cluster B. How can I do that? I logged into pod A cluster A and I did telnet hello.dnsb 80 and it doesn't get connected because I suspect there is no route. similarly I logged into pod B of cluster B and did telnet hello.dnsb 80 and it doesnt get connected. However If I do telnet hello.dnsb 80 or telnet hello.dnsb 80 from my host machine, telnet works!
Any simple way to solve this problem for now? I am ok with any solution like even adding routes manually using ip route add if needed
Skupper is a plugin available for performing these actions. It is a service interconnect that facilitates secured communication between the clusters, for more information on skupper go through this documentation.
There are multiple examples in which minikube is integrated with skupper, go through this configuration documentation for more details.

Remote kubernetes server unreachable

I tried to install kubernetes with Docker desktop. However, as soon as I type in
kubectl get nodes
I get Remote kubernetes server unreachable error.
I0217 23:42:56.224000 26220 versioner.go:56] Remote kubernetes server unreachable
Unable to connect to the server: dial tcp 172.28.112.98:6443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Any ideas on how to fix this?
Have you got more than one context in your kubeconfig?
You can check this with kubectl config get-contexts.
If necessary change your context to Docker Desktop Kubernetes using kubectl config use-context docker-desktop.
Is it possible that you may have tried minikube and this has left cluster/context in your .kube\config?
Configure Access to Multiple Clusters
go to your HOME/.kube directory and check the config file. There is a possibility that the server mentioned there is old or not reachable.
you can copy the new config file(from remote server of the other directory of tools like k3s) and add/replace it in your HOME/.kube / config file.
Same error message may also happen when you switch from local k8s cluster to a remote cluster that requires VPN to connect and you are not connected to VPN.

Failed to run exposed service on MacBook Pro M1

I try to run an exposed service on my Macbook(M1). However, I failed to browse the service locally. What could be the root cause?
Please see the attached images.
Is the shortcut command for fetching the minikube IP and a service’s NodePort not working?
minikube service --url <service-name>
There are some limitations with minikube running with docker driver on MacOS. Please see this GitHub issue.
There are two options at least (more, but these are simple to do):
use the minikube tunnel
Tunnel is used to expose the service from inside of the VM where minikube is running to the host machine's network. Please refer to access applications in minikube.
This is how minikube_IP:NodePort transforms to localhost:different_port.
start minikube with VirtualBox driver to get a proper IP (if you
really need to access your service on NodePort), below the command
how to start it with VirtualBox driver (this should be installed on
your machine):
minikube start --driver=VirtualBox

Calico node status returns Calico process is not running

I've problems getting with the BGP Peers of my Kubernetes clusters. My Cluster is built with 3 master nodes and 2 worker nodes on premise running on Unbuntu 18.04. The etcd is external configurered but running on 2 Master Nodes.
Initialy initialized with the pod cidr 172.16.0.0/16, but recently changed to 192.168.220.0/24.
I've installed Calico the latest version.
Every seems to be working OK when I configured a replicaset of 1 of each services. When I run multible pods I have connection problems with my configured services sometimes, sometimes not.
After some reasearch I discovered the problem could be a misconfiguration of Calico. When I run calicoctl node status I see this.
On the calico side I discovered it has something to do with BGP peering but I can't figure out what went wrong. The nodes had IP connectivity. A telnet session to port TCP 179 is also succesfull. What can I check next? Any help would be appreciated.

How to access minikube machine from outside?

I have a server running on ubuntu where I need to expose my app using kubernetes tools. I created a cluster using minikube with virtualbox machine and with the command kubectl expose deployment I was able tu expose my app... but only in my local network. It's mean that when I run minikube ip I receive a local ip. My question is how can I access my minikube machine from outside ?
I think the answer will be "port-forwarding".But how can I do that ?
You can use SSH port forwarding to access your services from host machine in the following way:
ssh -R 30000:127.0.0.1:8001 $USER#192.168.0.20
In which 8001 is port on which your service is exposed, 192.168.0.20 is minikube IP.
Now you'll be able to access your application from your laptop pointing the browser to http://192.168.0.20:30000
If you mean to access your machine from the internet, then the answer is yes "port-forwarding" and use the external ip address [https://www.whatismyip.com/]. The configurations go into your router settings. Check your router manual.