Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add x509 for faq #533

Merged
merged 6 commits into from
May 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,56 @@ Default 60 seconds, can be changed using `metrics-resolution` flag. We are not r

## Known issues

#### Incorrectly configured front-proxy certificate

Metrics Server needs to validate requests coming from kube-apiserver. You can recognize problems with front-proxy certificate configuration if you observe line below in your logs:
```
E0524 01:37:36.055326 1 authentication.go:65] Unable to authenticate the request due to an error: x509: certificate signed by unknown authority
```

To fix this problem you need to provide kube-apiserver proxy-client CA to Metrics Server under `--requestheader-client-ca-file` flag. You can read more about this flag in [Authenticating Proxy](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#authenticating-proxy)


For cluster created by kubeadm:

1. Find your front-proxy certificates by checking arguments passed in kube-apiserver config (by default located in /etc/kubernetes/manifests/kube-apiserver.yaml)

```
- --proxy-client-cert-file=/etc/kubernetes/pki/front-proxy-client.crt
- --proxy-client-key-file=/etc/kubernetes/pki/front-proxy-client.key
```

2. Create configmap including `front-proxy-ca.crt`

```
kubectl -nkube-system create configmap front-proxy-ca --from-file=front-proxy-ca.crt=/etc/kubernetes/pki/front-proxy-ca.crt -o yaml | kubectl -nkube-system replace configmap front-proxy-ca -f -
QianChenglong marked this conversation as resolved.
Show resolved Hide resolved
```

3. Mount configmap in Metrics Server deployment and add `--requestheader-client-ca-file` flag

```
Copy link
Contributor

@serathius serathius May 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Optional) Have you considered using kubectl patch instead?

Copy link
Contributor Author

@QianChenglong QianChenglong May 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, but it seems that patch cannot modify args.

- args:
- --requestheader-client-ca-file=/ca/front-proxy-ca.crt // ADD THIS!
- --cert-dir=/tmp
- --secure-port=4443
- --kubelet-insecure-tls // ignore validate kubelet x509
- --kubelet-preferred-address-types=InternalIP // using InternalIP to connect kubelet

volumeMounts:
- mountPath: /tmp
name: tmp-dir
- mountPath: /ca // ADD THIS!
name: ca-dir

volumes:
- emptyDir: {}
name: tmp-dir
- configMap: // ADD THIS!
defaultMode: 420
name: front-proxy-ca
name: ca-dir
```

#### Network problems

Metrics server needs to contact all nodes in cluster to collect metrics. Problems with network would can be recognized by following symptoms:
Expand Down