Description
What happened:
microk8s.kubectl get componentstatus
reports etcd not healthy:
> microk8s.kubectl get componentstatuses
NAME STATUS MESSAGE ERROR
etcd-0 Unhealthy Get http://etcd.socket:2379/health: dial tcp: lookup etcd.socket on 127.0.0.53:53: no such host
controller-manager Healthy ok
scheduler Healthy ok
What you expected to happen:
The cluster is healthy. I have no issue using the cluster. No problems to report, therefore I would expect:
> microk8s.kubectl get componentstatuses
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
scheduler Healthy ok
etcd-0 Healthy {"health":"true"}
How to reproduce it (as minimally and precisely as possible):
sudo snap install microk8s --classic
microk8s.kubectl get componentstatuses
Anything else we need to know?:
The problem is with etcd configured to listen to a unix socket and not a tcp port. You can see the etcd configuration under /var/snap/microk8s/current/args/etcd
(and also here https://github.com/ubuntu/microk8s/blob/master/microk8s-resources/default-args/etcd). The error says that etcd-0 is not available on http://.... which is true since it is available at unix://...
You can reconfigure etcd and the api server to talk over a tcp port. This way the component status reports everything as healthy. Update /var/snap/microk8s/current/args/etcd
with
--advertise-client-urls=http://localhost:2379
--listen-client-urls=http://localhost:2379
Update /var/snap/microk8s/current/args/kube-apiserver
with:
--etcd-servers='http://localhost:2379'
Restart the two services:
sudo systemctl restart snap.microk8s.daemon-etcd
sudo systemctl restart snap.microk8s.daemon-apiserver.service
Now microk8s.kubectl get componentstatuses
reports everything is healthy
Environment: Linux
- Kubernetes version (use
kubectl version
): 1.12 - Cloud provider or hardware configuration: local machine
- OS (e.g. from /etc/os-release): NAME="Ubuntu" VERSION="18.04.1 LTS (Bionic Beaver)"
- Kernel (e.g.
uname -a
): 4.15.0-34-generic - Install tools: snap
- Others:
/kind bug
Activity
dims commentedon Nov 7, 2018
please report in the microk8s repo - https://github.com/ubuntu/microk8s
/close
k8s-ci-robot commentedon Nov 7, 2018
@dims: Closing this issue.
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
ktsakalozos commentedon Nov 7, 2018
Hi @dims, I appreciate your prompt reply.
This is does not seem a microk8s issue. If you configure etcd to listen on a unix socket and point the apiserver to use that socket, etcd does not register as healthy. The use of unix sockets between apiserver and etcd is valid, right? Are you suggesting there is a bug in the configuration of microk8s? You want me to reproduce this bug on another distribution?
dims commentedon Nov 7, 2018
@ktsakalozos that would be great! since very few of us are familiar with how things are setup under microk8s. if you can just use the latest upstream release that would be even better.
from your report if i read it correctly currently kube-apiserver is not able to talk to etcd when etcd is listening on a unix socket and the default implementation is unable to connect to etcd and hence the failures. not sure if this is to be taken as a bug or a feature request :)
/sig api-machinery
ktsakalozos commentedon Nov 7, 2018
No. The kube-apiserver can talk to etcd with no problem. The cluster is operational, I do not see any issue with the cluster. It is only
get componentstatus
that falsely reports that etcd is unavailable. It seems that the case where etcd is available over aunix://
socket is not taken into account when probing etcd.I hope things are more clear now. This is not a feature request.
dims commentedon Nov 7, 2018
@ktsakalozos do you see any errors in the api server logs when you run
get componentstatus
?ktsakalozos commentedon Nov 7, 2018
I do no see any errors on the API server. Here is a a portion of the log:
And here is the invocation:
The logs were here
journalctl -u snap.microk8s.daemon-apiserver.service
after adding a-v=9
in/var/snap/microk8s/current/args/kube-apiserver
.okrause commentedon Nov 27, 2018
Same problem here. microk8s.daemon-apiserver is using my systems DNS resolver.
My systems DNS resolver doesn't know of "etcd.socket" host.
Is it supposed to ask the systems DNS resolver? I assume it is supposed to ask kube-dns.