-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* kubeadm support * move k8s master to a subtask * disable k8s secrets when using kubeadm * fix etcd cert serial var * move simple auth users to master role * make a kubeadm-specific env file for kubelet * add non-ha CI job * change ci boolean vars to json format * fixup * Update create-gce.yml * Update create-gce.yml * Update create-gce.yml
- Loading branch information
Showing
35 changed files
with
469 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
- name: Set kubeadm_discovery_address | ||
set_fact: | ||
kubeadm_discovery_address: >- | ||
{%- if "127.0.0.1" or "localhost" in kube_apiserver_endpoint -%} | ||
{{ first_kube_master }}:{{ kube_apiserver_port }} | ||
{%- else -%} | ||
{{ kube_apiserver_endpoint }} | ||
{%- endif %} | ||
when: not is_kube_master | ||
tags: facts | ||
|
||
- name: Create kubeadm client config | ||
template: | ||
src: kubeadm-client.conf.j2 | ||
dest: "{{ kube_config_dir }}/kubeadm-client.conf" | ||
backup: yes | ||
when: not is_kube_master | ||
register: kubeadm_client_conf | ||
|
||
- name: Join to cluster if needed | ||
command: kubeadm join --config {{ kube_config_dir}}/kubeadm-client.conf --skip-preflight-checks | ||
register: kubeadm_join | ||
when: not is_kube_master and kubeadm_client_conf.changed | ||
|
||
- name: Update server field in kubelet kubeconfig | ||
replace: | ||
path: "{{ kube_config_dir }}/kubelet.conf" | ||
regexp: '(\s+){{ first_kube_master }}:{{ kube_apiserver_port }}(\s+.*)?$' | ||
replace: '\1{{ kube_apiserver_endpoint }}\2' | ||
backup: yes | ||
when: not is_kube_master and kubeadm_discovery_address != kube_apiserver_endpoint | ||
|
||
# FIXME(mattymo): Reconcile kubelet kubeconfig filename for both deploy modes | ||
- name: Symlink kubelet kubeconfig for calico/canal | ||
file: | ||
src: "{{ kube_config_dir }}//kubelet.conf" | ||
dest: "{{ kube_config_dir }}/node-kubeconfig.yaml" | ||
state: link | ||
force: yes | ||
when: kube_network_plugin in ['calico','canal'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kubeadm.k8s.io/v1alpha1 | ||
kind: NodeConfiguration | ||
caCertPath: {{ kube_config_dir }}/ssl/ca.crt | ||
token: {{ kubeadm_token }} | ||
discoveryTokenAPIServers: | ||
- {{ kubeadm_discovery_address | replace("https://", "")}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
- name: kubeadm | aggregate all SANs | ||
set_fact: | ||
apiserver_sans: >- | ||
kubernetes | ||
kubernetes.default | ||
kubernetes.default.svc | ||
kubernetes.default.svc.{{ dns_domain }} | ||
{{ kube_apiserver_ip }} | ||
localhost | ||
127.0.0.1 | ||
{{ ' '.join(groups['kube-master']) }} | ||
{%- if loadbalancer_apiserver is defined and apiserver_loadbalancer_domain_name is defined %} | ||
{{ apiserver_loadbalancer_domain_name }} | ||
{%- endif %} | ||
{%- for host in groups['kube-master'] -%} | ||
{%- if hostvars[host]['access_ip'] is defined %}{{ hostvars[host]['access_ip'] }}{% endif -%} | ||
{{ hostvars[host]['ip'] | default(hostvars[host]['ansible_default_ipv4']['address']) }} | ||
{%- endfor %} | ||
tags: facts | ||
|
||
- name: kubeadm | Copy etcd cert dir under k8s cert dir | ||
command: "cp -TR {{ etcd_cert_dir }} {{ kube_config_dir }}/ssl/etcd" | ||
changed_when: false | ||
|
||
- name: kubeadm | Create kubeadm config | ||
template: | ||
src: kubeadm-config.yaml.j2 | ||
dest: "{{ kube_config_dir }}/kubeadm-config.yaml" | ||
register: kubeadm_config | ||
|
||
- name: kubeadm | Initialize cluster | ||
command: timeout -k 240s 240s kubeadm init --config={{ kube_config_dir }}/kubeadm-config.yaml --skip-preflight-checks | ||
register: kubeadm_init | ||
when: kubeadm_config.changed |
Oops, something went wrong.