大网数据广告活动
服务器运维问答

Kube dns wont connect to the Kubernetes api process

· 52CE 我爱测

Running kubernetes v1.10.0 amd kube-dns using the gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.8 container When the kube-dns container starts it says this in the log: I0610 06:47:06.051414 1 round_trippers.go:398] curl -k…

问题原文

原帖链接 · GeoSword · CC BY-SA 4.0

Running kubernetes v1.10.0 amd kube-dns using the gcr.io/google_containers/k8s-dns-kube-dns-amd64:1.14.8 container

When the kube-dns container starts it says this in the log:

I0610 06:47:06.051414       1 round_trippers.go:398] curl -k -v -XGET  -H "User-Agent: kube-dns/1.14.10 (linux/amd64)" -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6Ikp... rest of barer token" -H "Accept: application/vnd.kubernetes.protobuf, */*" https://172.17.0.1:443/api/v1/services?resourceVersion=0
`E0610 06:47:05.058513       1 reflector.go:201] k8s.io/dns/pkg/dns/dns.go:189: Failed to list *v1.Endpoints: Get https://172.17.0.1:443/api/v1/endpoints?resourceVersion=0: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "10.16.23.40")`

10.16.23.40 is the "real" address of my master, 172.17.0.1 is the service address of the master.

I have a self signed certificate on the apiserver, which understandably throws the usual verification errors if accessed with curl (from the command line of anything), without -k. The output from kube-dns however seems to imply that -k is used, although I can find no evidence of curl actually existing on the container, which leads me to believe that the binary curl is not actually being called, but the curl command is just being output to "help". The existence of toCurl in round_trippers.go seems to back this theory up.

Looking at the output, yes, the certificate is self-signed, and therefore "signed by an unknown authority" makes a certain amount of sense, but if its making the call with -k (or whatever its equivalent is within the code) Then that should not be an issue.

Here are some relevant lines in the certificate:

Subject: C=UK, ST=Blah, L=Blah, O=system:nodes, OU=Blah, CN=10.16.23.40

And

X509v3 Subject Alternative Name: 
                DNS:kubernetes, DNS:kubernetes.default, DNS:kubernetes.default.svc, DNS:kubernetes.default.svc.cluster, DNS:kubernetes.default.svc.cluster.local, DNS:cluster.local, DNS:k8s.blah.net, IP Address:10.16.23.40, IP Address:172.17.0.1

Naturally everything else that needs to access the apiserver (e.g. kubectl) executes without a problem and without any kind of verification error.

Any pointers on how to get kube-dns talking to the apiserver would be most appreciated.

Thanks In advance

已采纳解答

原帖链接 · GeoSword · CC BY-SA 4.0

I Found the problem was actually in the controller-manager. I had specified --master= on the command line which was overriding the value in the controller-manager config file. Removed that, restarted controller-manager kube-dns functions as expected. The verification error while apparently talking to the api server was somewhat of a red-herring.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-06-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。