@@ -588,7 +588,7 @@ function create-master-auth {
588
588
append_or_replace_prefixed_line " ${known_tokens_csv} " " ${KUBE_BEARER_TOKEN} ," " admin,admin,system:masters"
589
589
fi
590
590
if [[ -n " ${KUBE_BOOTSTRAP_TOKEN:- } " ]]; then
591
- append_or_replace_prefixed_line " ${known_tokens_csv} " " ${KUBE_BOOTSTRAP_TOKEN} ," " system:cluster -bootstrap,uid:system:cluster -bootstrap,system:masters"
591
+ append_or_replace_prefixed_line " ${known_tokens_csv} " " ${KUBE_BOOTSTRAP_TOKEN} ," " gcp:kube -bootstrap,uid:gcp:kube -bootstrap,system:masters"
592
592
fi
593
593
if [[ -n " ${KUBE_CONTROLLER_MANAGER_TOKEN:- } " ]]; then
594
594
append_or_replace_prefixed_line " ${known_tokens_csv} " " ${KUBE_CONTROLLER_MANAGER_TOKEN} ," " system:kube-controller-manager,uid:system:kube-controller-manager"
@@ -1506,7 +1506,7 @@ function compute-master-manifest-variables {
1506
1506
INSECURE_PORT_MAPPING=" "
1507
1507
if [[ " ${ENABLE_APISERVER_INSECURE_PORT:- false} " == " true" ]]; then
1508
1508
INSECURE_PORT_MAPPING=" { \" name\" : \" local\" , \" containerPort\" : 8080, \" hostPort\" : 8080},"
1509
- fi
1509
+ fi
1510
1510
}
1511
1511
1512
1512
# A helper function that bind mounts kubelet dirs for running mount in a chroot
@@ -2846,11 +2846,12 @@ function wait-till-apiserver-ready() {
2846
2846
done
2847
2847
}
2848
2848
2849
- function ensure-bootstrap-kubectl-auth {
2850
- # Creating an authenticated kubeconfig is only necessary if the insecure port is disabled.
2849
+ function ensure-master-bootstrap-kubectl-auth {
2850
+ # By default, `kubectl` uses http://localhost:8080
2851
+ # If the insecure port is disabled, kubectl will need to use an admin-authenticated kubeconfig.
2851
2852
if [[ -n " ${KUBE_BOOTSTRAP_TOKEN:- } " ]]; then
2852
- create-kubeconfig " cluster -bootstrap" ${KUBE_BOOTSTRAP_TOKEN}
2853
- export KUBECONFIG=/etc/srv/kubernetes/cluster -bootstrap/kubeconfig
2853
+ create-kubeconfig " kube -bootstrap" " ${KUBE_BOOTSTRAP_TOKEN} "
2854
+ export KUBECONFIG=/etc/srv/kubernetes/kube -bootstrap/kubeconfig
2854
2855
fi
2855
2856
}
2856
2857
@@ -2971,13 +2972,13 @@ function main() {
2971
2972
KUBE_CONTROLLER_MANAGER_TOKEN=" $( secure_random 32) "
2972
2973
KUBE_SCHEDULER_TOKEN=" $( secure_random 32) "
2973
2974
KUBE_CLUSTER_AUTOSCALER_TOKEN=" $( secure_random 32) "
2974
- if [[ " ${ENABLE_APISERVER_INSECURE_PORT:- false} " != " true" ]]; then
2975
- KUBE_BOOTSTRAP_TOKEN=" $( secure_random 32) "
2976
- fi
2977
2975
if [[ " ${ENABLE_L7_LOADBALANCING:- } " == " glbc" ]]; then
2978
2976
GCE_GLBC_TOKEN=" $( secure_random 32) "
2979
2977
fi
2980
2978
ADDON_MANAGER_TOKEN=" $( secure_random 32) "
2979
+ if [[ " ${ENABLE_APISERVER_INSECURE_PORT:- false} " != " true" ]]; then
2980
+ KUBE_BOOTSTRAP_TOKEN=" $( secure_random 32) "
2981
+ fi
2981
2982
2982
2983
setup-os-params
2983
2984
config-ip-firewall
@@ -2990,7 +2991,7 @@ function main() {
2990
2991
create-node-pki
2991
2992
create-master-pki
2992
2993
create-master-auth
2993
- ensure-bootstrap-kubectl-auth
2994
+ ensure-master- bootstrap-kubectl-auth
2994
2995
create-master-kubelet-auth
2995
2996
create-master-etcd-auth
2996
2997
create-master-etcd-apiserver-auth
0 commit comments