New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use presence of kubeconfig file to toggle standalone mode #40050
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -624,7 +624,13 @@ EOF | |
| fi | ||
| } | ||
|
|
||
| function create-kubelet-kubeconfig { | ||
| # Arg 1: the IP address of the API server | ||
| function create-kubelet-kubeconfig() { | ||
| local apiserver_address="${1}" | ||
| if [[ -z "${apiserver_address}" ]]; then | ||
| echo "Must provide API server address to create Kubelet kubeconfig file!" | ||
| exit 1 | ||
| fi | ||
| echo "Creating kubelet kubeconfig file" | ||
| cat <<EOF >/var/lib/kubelet/bootstrap-kubeconfig | ||
| apiVersion: v1 | ||
|
|
@@ -637,6 +643,7 @@ users: | |
| clusters: | ||
| - name: local | ||
| cluster: | ||
| server: https://${apiserver_address} | ||
| certificate-authority: ${CA_CERT_BUNDLE_PATH} | ||
| server: https://${KUBERNETES_MASTER_NAME} | ||
| contexts: | ||
|
|
@@ -657,7 +664,7 @@ function create-master-kubelet-auth { | |
| # set in the environment. | ||
| if [[ -n "${KUBELET_APISERVER:-}" && -n "${KUBELET_CERT:-}" && -n "${KUBELET_KEY:-}" ]]; then | ||
| REGISTER_MASTER_KUBELET="true" | ||
| create-kubelet-kubeconfig | ||
| create-kubelet-kubeconfig ${KUBELET_APISERVER} | ||
| fi | ||
| } | ||
|
|
||
|
|
@@ -898,7 +905,6 @@ function start-kubelet { | |
| #flags+=" --bootstrap-kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig" | ||
| #flags+=" --kubeconfig=/var/lib/kubelet/kubeconfig" | ||
| flags+=" --kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig" | ||
| flags+=" --require-kubeconfig" | ||
| flags+=" --register-schedulable=false" | ||
| else | ||
| # Standalone mode (not widely used?) | ||
|
|
@@ -908,7 +914,6 @@ function start-kubelet { | |
| flags+=" ${NODE_KUBELET_TEST_ARGS:-}" | ||
| flags+=" --enable-debugging-handlers=true" | ||
| flags+=" --bootstrap-kubeconfig=/var/lib/kubelet/bootstrap-kubeconfig" | ||
| flags+=" --require-kubeconfig" | ||
| flags+=" --kubeconfig=/var/lib/kubelet/kubeconfig" | ||
| if [[ "${HAIRPIN_MODE:-}" == "promiscuous-bridge" ]] || \ | ||
| [[ "${HAIRPIN_MODE:-}" == "hairpin-veth" ]] || \ | ||
|
|
@@ -951,7 +956,7 @@ function start-kubelet { | |
| fi | ||
| if [[ -n "${NODE_TAINTS:-}" ]]; then | ||
| flags+=" --register-with-taints=${NODE_TAINTS}" | ||
| fi | ||
| fi | ||
| if [[ -n "${EVICTION_HARD:-}" ]]; then | ||
| flags+=" --eviction-hard=${EVICTION_HARD}" | ||
| fi | ||
|
|
@@ -1875,7 +1880,7 @@ if [[ "${KUBERNETES_MASTER:-}" == "true" ]]; then | |
| create-master-etcd-auth | ||
| else | ||
| create-node-pki | ||
| create-kubelet-kubeconfig | ||
| create-kubelet-kubeconfig ${KUBERNETES_MASTER_NAME} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before we used two different values for the apiserver address, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The GCE tests should cover the "is registered" case and the GKE tests should cover the "is not registered" case. |
||
| create-kubeproxy-kubeconfig | ||
| if [[ "${ENABLE_NODE_PROBLEM_DETECTOR:-}" == "standalone" ]]; then | ||
| create-node-problem-detector-kubeconfig | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ coreos: | |
| --address=0.0.0.0 \ | ||
| --hostname-override=${NODE_IPS[$i]} \ | ||
| --cluster-domain=cluster.local \ | ||
| --api-servers=http://${MASTER_IP}:8080 \ | ||
| --kubeconfig=/opt/kubernetes/kubeconfig/kubelet.kubeconfig \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this path right? I don't see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment on kubernetes/kubeconfig/kubelet.kubeconfig alliteration There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can tell, I could have the wrong read on how this works, but this tracks with several other things in |
||
| --tls-cert-file=/opt/kubernetes/certs/${NODE_NAMES[$i]}-node.pem \ \ | ||
| --tls-private-key-file=/opt/kubernetes/certs/${NODE_NAMES[$i]}-node-key.pem \ | ||
| $( [[ "$ENABLE_CLUSTER_DNS" == "true" ]] && echo "--cluster-dns=${DNS_SERVER_IP}" ) \ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
want to make sure we error if called without an address... no telling what is making use of
create-kubelet-kubeconfigThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done