Merge pull request #76792 from dekkagaijin/insecure-port

add option to disable the apiserver's insecure port via env var
k3s-v1.15.3
Kubernetes Prow Robot 2019-04-23 14:02:35 -07:00 committed by GitHub
commit 06bc7e3e00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -1593,6 +1593,10 @@ function start-kube-apiserver {
params+=" --etcd-servers-overrides=${ETCD_SERVERS_OVERRIDES:-}"
fi
params+=" --secure-port=443"
if [[ "${ENABLE_APISERVER_INSECURE_PORT:-true}" != "true" ]]; then
# Default is :8080
params+=" --insecure-port=0"
fi
params+=" --tls-cert-file=${APISERVER_SERVER_CERT_PATH}"
params+=" --tls-private-key-file=${APISERVER_SERVER_KEY_PATH}"
params+=" --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname"
@ -1878,7 +1882,6 @@ function start-kube-apiserver {
sed -i -e "s@{{pillar\['allow_privileged'\]}}@true@g" "${src_file}"
sed -i -e "s@{{liveness_probe_initial_delay}}@${KUBE_APISERVER_LIVENESS_PROBE_INITIAL_DELAY_SEC:-15}@g" "${src_file}"
sed -i -e "s@{{secure_port}}@443@g" "${src_file}"
sed -i -e "s@{{secure_port}}@8080@g" "${src_file}"
sed -i -e "s@{{additional_cloud_config_mount}}@@g" "${src_file}"
sed -i -e "s@{{additional_cloud_config_volume}}@@g" "${src_file}"
sed -i -e "s@{{webhook_authn_config_mount}}@${webhook_authn_config_mount}@g" "${src_file}"

View File

@ -32,8 +32,9 @@
{{container_env}}
"livenessProbe": {
"httpGet": {
"scheme": "HTTPS",
"host": "127.0.0.1",
"port": 8080,
"port": {{secure_port}},
"path": "/healthz?exclude=etcd"
},
"initialDelaySeconds": {{liveness_probe_initial_delay}},
@ -41,8 +42,9 @@
},
"readinessProbe": {
"httpGet": {
"scheme": "HTTPS",
"host": "127.0.0.1",
"port": 8080,
"port": {{secure_port}},
"path": "/healthz"
},
"periodSeconds": 1,