CA cert in kubectl config file invalid
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Kubernetes Control Plane Charm |
Fix Released
|
Medium
|
Mike Wilson |
Bug Description
The base64 encoded CA cert in the kubectl config file doesn't contain a newline after the certificate end tag. This isn't a problem for `kubectl` itself, but it is a problem for the golang k8s client library. When you run a controller using this config file, you get an error message saying that CA is unknown:
Controller example repo: https:/
```console
$ go build && ./k8s-controlle
INFO[0000] Successfully constructed k8s client
INFO[0000] Controller.Run: initiating
ERROR: logging before flag.Parse: E0507 14:07:01.479764 30683 reflector.go:205] k8s-controller-
```
```console
merlijn@
-----BEGIN CERTIFICATE-----
MIIDODCCAiCgAwI
BAMMDDEwLjEwLjE
MBcxFTATBgNVBAM
ADCCAQoCggEBAMY
Lm31FSO3NM+
T02f14/
XGRZcOaGHpFEPrY
zLfrG1pdORasCUJ
mx6LssSDnbsEr0w
dumpSQssby3YQgp
1xuJrEChG6QZMBc
A1UdEwQFMAMBAf8
rr7k+JecLvHvIji
ouYpVsIOjvdUiua
2ZWBEPKOfyE66eC
/kn0uKrFFBWTn11
wOzoip3oCDsRMgs
4SUk8EV0D8EX/NbG
-----END CERTIFICATE-
```
Changing the base64-encoded certificate to include a newline fixes the issue.
```console
$ cat ~/.kube/config | grep -oP 'certificate-
-----BEGIN CERTIFICATE-----
MIIDODCCAiCgAwI
BAMMDDEwLjEwLjE
MBcxFTATBgNVBAM
ADCCAQoCggEBAMY
Lm31FSO3NM+
T02f14/
XGRZcOaGHpFEPrY
zLfrG1pdORasCUJ
mx6LssSDnbsEr0w
dumpSQssby3YQgp
1xuJrEChG6QZMBc
A1UdEwQFMAMBAf8
rr7k+JecLvHvIji
ouYpVsIOjvdUiua
2ZWBEPKOfyE66eC
/kn0uKrFFBWTn11
wOzoip3oCDsRMgs
4SUk8EV0D8EX/NbG
-----END CERTIFICATE-----
merlijn@howard$
```
```console
$ go build && ./k8s-controlle
INFO[0000] Successfully constructed k8s client
INFO[0000] Controller.Run: initiating
INFO[0000] Add service: k8s-tengu-
INFO[0000] Controller.Run: cache sync complete
INFO[0000] Controller.
INFO[0000] Controller.
INFO[0000] Controller.
INFO[0000] TestHandler.
INFO[0000] ResourceVersion: 2518213
INFO[0000] ExternalName: idlab-iot.tengu.io
INFO[0000] Phase: []
INFO[0000] Controller.
INFO[0000] Controller.
```
description: | updated |
affects: | charm-aws-integrator → charm-kubernetes-master |
description: | updated |
Changed in charm-kubernetes-master: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in charm-kubernetes-master: | |
assignee: | nobody → Mike Wilson (knobby) |
Changed in charm-kubernetes-master: | |
status: | Triaged → In Progress |
Changed in charm-kubernetes-master: | |
status: | In Progress → Fix Committed |
Changed in charm-kubernetes-master: | |
milestone: | none → 1.15 |
Changed in charm-kubernetes-master: | |
status: | Fix Committed → Fix Released |
https:/ /github. com/juju- solutions/ layer-tls- client/ pull/17