mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Implement apiserver communication for Vagrant
This implementation is based on the GCE impementation from
618a367dbb
.
This commit is contained in:
parent
7d3cac35a5
commit
7d37b24cc7
@ -40,7 +40,7 @@
|
|||||||
{% set token_auth_file = "-token_auth_file=/dev/null" -%}
|
{% set token_auth_file = "-token_auth_file=/dev/null" -%}
|
||||||
|
|
||||||
{% if grains.cloud is defined -%}
|
{% if grains.cloud is defined -%}
|
||||||
{% if grains.cloud == 'gce' -%}
|
{% if grains.cloud == 'gce' or grains.cloud == 'vagrant' -%}
|
||||||
# TODO: generate and distribute tokens for other cloud providers.
|
# TODO: generate and distribute tokens for other cloud providers.
|
||||||
{% set token_auth_file = "-token_auth_file=/srv/kubernetes/known_tokens.csv" -%}
|
{% set token_auth_file = "-token_auth_file=/srv/kubernetes/known_tokens.csv" -%}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if grains.cloud is defined %}
|
{% if grains.cloud is defined %}
|
||||||
{% if grains.cloud == 'gce' %}
|
{% if grains.cloud == 'gce' or grains.cloud == 'vagrant' %}
|
||||||
# TODO: generate and distribute tokens on other cloud providers.
|
# TODO: generate and distribute tokens on other cloud providers.
|
||||||
/srv/kubernetes/known_tokens.csv:
|
/srv/kubernetes/known_tokens.csv:
|
||||||
file.managed:
|
file.managed:
|
||||||
|
@ -108,6 +108,19 @@ state_verbose: False
|
|||||||
state_output: mixed
|
state_output: mixed
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Generate and distribute a shared secret (bearer token) to
|
||||||
|
# apiserver and kubelet so that kubelet can authenticate to
|
||||||
|
# apiserver to send events.
|
||||||
|
kubelet_token=$(cat /dev/urandom | base64 | tr -d "=+/" | dd bs=32 count=1 2> /dev/null)
|
||||||
|
|
||||||
|
mkdir -p /srv/salt-overlay/salt/kube-apiserver
|
||||||
|
known_tokens_file="/srv/salt-overlay/salt/kube-apiserver/known_tokens.csv"
|
||||||
|
(umask u=rw,go= ; echo "$kubelet_token,kubelet,kubelet" > $known_tokens_file)
|
||||||
|
|
||||||
|
mkdir -p /srv/salt-overlay/salt/kubelet
|
||||||
|
kubelet_auth_file="/srv/salt-overlay/salt/kubelet/kubernetes_auth"
|
||||||
|
(umask u=rw,go= ; echo "{\"BearerToken\": \"$kubelet_token\", \"Insecure\": true }" > $kubelet_auth_file)
|
||||||
|
|
||||||
# Configure nginx authorization
|
# Configure nginx authorization
|
||||||
mkdir -p "$KUBE_TEMP"
|
mkdir -p "$KUBE_TEMP"
|
||||||
mkdir -p /srv/salt-overlay/salt/nginx
|
mkdir -p /srv/salt-overlay/salt/nginx
|
||||||
|
Loading…
Reference in New Issue
Block a user