From 19a68ef51c6b9a343df7e6c2297bff34a38393f6 Mon Sep 17 00:00:00 2001 From: Mike Danese Date: Tue, 7 Mar 2017 14:22:11 -0800 Subject: [PATCH] generate kubelet auth cert on upgrades --- cluster/gce/upgrade.sh | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/cluster/gce/upgrade.sh b/cluster/gce/upgrade.sh index 33a67cdbe6d..5286bd47e5b 100755 --- a/cluster/gce/upgrade.sh +++ b/cluster/gce/upgrade.sh @@ -88,6 +88,7 @@ function upgrade-master() { detect-master parse-master-env + backfile-kubeletauth-certs # Delete the master instance. Note that the master-pd is created # with auto-delete=no, so it should not be deleted. @@ -101,6 +102,51 @@ function upgrade-master() { wait-for-master } +# TODO(mikedanese): delete when we don't support < 1.6 +function backfile-kubeletauth-certs() { + if [[ ! -z "${KUBEAPISERVER_CERT_BASE64:-}" && ! -z "${KUBEAPISERVER_CERT_BASE64:-}" ]]; then + return 0 + fi + + mkdir -p "${KUBE_TEMP}/pki" + echo "${CA_KEY_BASE64}" | base64 -d > "${KUBE_TEMP}/pki/ca.key" + echo "${CA_CERT_BASE64}" | base64 -d > "${KUBE_TEMP}/pki/ca.crt" + (cd "${KUBE_TEMP}/pki" + download-cfssl + cat < ca-config.json +{ + "signing": { + "client": { + "expiry": "43800h", + "usages": [ + "signing", + "key encipherment", + "client auth" + ] + } + } +} +EOF + # the name kube-apiserver is bound to the node proxy + # subpaths required for the apiserver to hit proxy + # endpoints on the kubelet's handler. + cat <