mirror of https://github.com/k3s-io/k3s
pass CA key to signer in GCE
parent
093ceb9528
commit
513994a9f8
|
@ -586,6 +586,7 @@ function build-kube-master-certs {
|
||||||
KUBEAPISERVER_CERT: $(yaml-quote ${KUBEAPISERVER_CERT_BASE64:-})
|
KUBEAPISERVER_CERT: $(yaml-quote ${KUBEAPISERVER_CERT_BASE64:-})
|
||||||
KUBEAPISERVER_KEY: $(yaml-quote ${KUBEAPISERVER_KEY_BASE64:-})
|
KUBEAPISERVER_KEY: $(yaml-quote ${KUBEAPISERVER_KEY_BASE64:-})
|
||||||
KUBELET_AUTH_CA_CERT: $(yaml-quote ${KUBELET_AUTH_CA_CERT_BASE64:-})
|
KUBELET_AUTH_CA_CERT: $(yaml-quote ${KUBELET_AUTH_CA_CERT_BASE64:-})
|
||||||
|
CA_KEY: $(yaml-quote ${CA_KEY_BASE64:-})
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -961,6 +962,7 @@ function create-certs {
|
||||||
CERT_DIR="${KUBE_TEMP}/easy-rsa-master/easyrsa3"
|
CERT_DIR="${KUBE_TEMP}/easy-rsa-master/easyrsa3"
|
||||||
# By default, linux wraps base64 output every 76 cols, so we use 'tr -d' to remove whitespaces.
|
# By default, linux wraps base64 output every 76 cols, so we use 'tr -d' to remove whitespaces.
|
||||||
# Note 'base64 -w0' doesn't work on Mac OS X, which has different flags.
|
# Note 'base64 -w0' doesn't work on Mac OS X, which has different flags.
|
||||||
|
CA_KEY_BASE64=$(cat "${CERT_DIR}/pki/private/ca.key" | base64 | tr -d '\r\n')
|
||||||
CA_CERT_BASE64=$(cat "${CERT_DIR}/pki/ca.crt" | base64 | tr -d '\r\n')
|
CA_CERT_BASE64=$(cat "${CERT_DIR}/pki/ca.crt" | base64 | tr -d '\r\n')
|
||||||
MASTER_CERT_BASE64=$(cat "${CERT_DIR}/pki/issued/${MASTER_NAME}.crt" | base64 | tr -d '\r\n')
|
MASTER_CERT_BASE64=$(cat "${CERT_DIR}/pki/issued/${MASTER_NAME}.crt" | base64 | tr -d '\r\n')
|
||||||
MASTER_KEY_BASE64=$(cat "${CERT_DIR}/pki/private/${MASTER_NAME}.key" | base64 | tr -d '\r\n')
|
MASTER_KEY_BASE64=$(cat "${CERT_DIR}/pki/private/${MASTER_NAME}.key" | base64 | tr -d '\r\n')
|
||||||
|
|
|
@ -215,6 +215,9 @@ function create-master-auth {
|
||||||
echo "${MASTER_CERT}" | base64 --decode > "${auth_dir}/server.cert"
|
echo "${MASTER_CERT}" | base64 --decode > "${auth_dir}/server.cert"
|
||||||
echo "${MASTER_KEY}" | base64 --decode > "${auth_dir}/server.key"
|
echo "${MASTER_KEY}" | base64 --decode > "${auth_dir}/server.key"
|
||||||
fi
|
fi
|
||||||
|
if [[ ! -z "${CA_KEY:-}" ]]; then
|
||||||
|
echo "${CA_KEY}" | base64 --decode > "${auth_dir}/ca.key"
|
||||||
|
fi
|
||||||
if [ ! -e "${auth_dir}/kubeapiserver.cert" ] && [[ ! -z "${KUBEAPISERVER_CERT:-}" ]] && [[ ! -z "${KUBEAPISERVER_KEY:-}" ]]; then
|
if [ ! -e "${auth_dir}/kubeapiserver.cert" ] && [[ ! -z "${KUBEAPISERVER_CERT:-}" ]] && [[ ! -z "${KUBEAPISERVER_KEY:-}" ]]; then
|
||||||
echo "${KUBEAPISERVER_CERT}" | base64 --decode > "${auth_dir}/kubeapiserver.cert"
|
echo "${KUBEAPISERVER_CERT}" | base64 --decode > "${auth_dir}/kubeapiserver.cert"
|
||||||
echo "${KUBEAPISERVER_KEY}" | base64 --decode > "${auth_dir}/kubeapiserver.key"
|
echo "${KUBEAPISERVER_KEY}" | base64 --decode > "${auth_dir}/kubeapiserver.key"
|
||||||
|
@ -971,6 +974,10 @@ function start-kube-controller-manager {
|
||||||
if [[ -n "${CLUSTER_IP_RANGE:-}" ]]; then
|
if [[ -n "${CLUSTER_IP_RANGE:-}" ]]; then
|
||||||
params+=" --cluster-cidr=${CLUSTER_IP_RANGE}"
|
params+=" --cluster-cidr=${CLUSTER_IP_RANGE}"
|
||||||
fi
|
fi
|
||||||
|
if [[ -n "${CA_KEY:-}" ]]; then
|
||||||
|
params+=" --cluster-signing-cert-file=/etc/srv/kubernetes/ca.crt"
|
||||||
|
params+=" --cluster-signing-key-file=/etc/srv/kubernetes/ca.key"
|
||||||
|
fi
|
||||||
if [[ -n "${SERVICE_CLUSTER_IP_RANGE:-}" ]]; then
|
if [[ -n "${SERVICE_CLUSTER_IP_RANGE:-}" ]]; then
|
||||||
params+=" --service-cluster-ip-range=${SERVICE_CLUSTER_IP_RANGE}"
|
params+=" --service-cluster-ip-range=${SERVICE_CLUSTER_IP_RANGE}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue