kube-lego icon indicating copy to clipboard operation
kube-lego copied to clipboard

the server has asked for the client to provide credentials error

Open lukesmith opened this issue 9 years ago • 6 comments

I'm getting the follow error (and all that is in the logs) when the pod starts. I assume this is when kube-lego tries to talk to my kube-api

2016-10-18T00:28:29.478223138Z time="2016-10-18T00:28:29Z" level=info msg="kube-lego 0.1.2-03c268d7 starting" context=kubelego 
2016-10-18T00:28:29.513084276Z time="2016-10-18T00:28:29Z" level=fatal msg="the server has asked for the client to provide credentials" context=kubelego 

lukesmith avatar Oct 18 '16 00:10 lukesmith

Interesting issue, can you provide the cli flags you run your API server with?

It looks like you requiring cert auth against Kubernetes API

simonswine avatar Oct 18 '16 19:10 simonswine

"the server has asked for the client to provide credentials"

this can be triggered by an invalid service account. Please check the certificate is not expired.

aledbf avatar Oct 18 '16 19:10 aledbf

I use certs for all communication with the API server.

I can't see a way to use certs, or use a kubeconfig file, with kube-lego if it's possible?

My kube api flags are

          image: quay.io/coreos/hyperkube:v1.4.1_coreos.0
          command:
          - /hyperkube
          - apiserver
          - --bind-address=0.0.0.0
          - --etcd-servers=https://127.0.0.1:2379
          - --allow-privileged=true
          - --service-cluster-ip-range=10.3.0.0/24
          - --secure-port=443
          - --advertise-address={{.node.ip_v4.private}}
          - --admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,ResourceQuota
          - --tls-cert-file=/etc/kubernetes/ssl/apiserver.pem
          - --tls-private-key-file=/etc/kubernetes/ssl/apiserver-key.pem
          - --client-ca-file=/etc/kubernetes/ssl/ca.pem
          - --service-account-key-file=/etc/kubernetes/ssl/apiserver-key.pem
          - --runtime-config=extensions/v1beta1=true,extensions/v1beta1/networkpolicies=true
          - --etcd-cafile=/etc/ssl/etcd/ca.pem
          - --etcd-certfile=/etc/ssl/etcd/etcd.pem
          - --etcd-keyfile=/etc/ssl/etcd/etcd-key.pem

lukesmith avatar Oct 18 '16 19:10 lukesmith

@lukesmith have you tried to mount a kubeconfig file using a secret to /root/.kube/config?

It think this is preventing it from working: https://github.com/jetstack/kube-lego/blob/master/pkg/kubelego/kube.go#L23

But it would be good to make that work..

simonswine avatar Oct 18 '16 21:10 simonswine

Mounting a kubeconfig file to /root/.kube/config causes the same error.

lukesmith avatar Oct 18 '16 22:10 lukesmith

i have the save error. how to fix. kube-error.txt

luohoufu avatar Nov 10 '16 03:11 luohoufu