Browse Source
Add scale master features (#3946)
Add scale master features (#3946)
* Add scale master features * Add certificate management with kubeadm * Add kubeadm kubeconfig * Fix ymalroles error * fix upgrade cluster fialed * force update cert and keys when you reconfigure clusterpull/3952/head
Rong Zhang
5 years ago
committed by
Kubernetes Prow Robot
4 changed files with 94 additions and 7 deletions
Split View
Diff Options
-
1roles/download/tasks/kubeadm_images.yml
-
42roles/kubernetes/master/tasks/kubeadm-certificate.yml
-
32roles/kubernetes/master/tasks/kubeadm-kubeconfig.yml
-
26roles/kubernetes/master/tasks/kubeadm-setup.yml
@ -0,0 +1,42 @@ |
|||
--- |
|||
- name: Backup old certs and keys |
|||
copy: |
|||
src: "{{ kube_cert_dir }}/{{ item.src }}" |
|||
dest: "{{ kube_cert_dir }}/{{ item.dest }}" |
|||
remote_src: yes |
|||
with_items: |
|||
- {src: apiserver.crt, dest: apiserver.crt.old} |
|||
- {src: apiserver.key, dest: apiserver.key.old} |
|||
- {src: apiserver-kubelet-client.crt, dest: apiserver-kubelet-client.crt.old} |
|||
- {src: apiserver-kubelet-client.key, dest: apiserver-kubelet-client.key.old} |
|||
- {src: front-proxy-client.crt, dest: front-proxy-client.crt.old} |
|||
- {src: front-proxy-client.key, dest: front-proxy-client.key.old} |
|||
ignore_errors: yes |
|||
|
|||
- name: Remove old certs and keys |
|||
file: |
|||
path: "{{ kube_cert_dir }}/{{ item }}" |
|||
state: absent |
|||
with_items: |
|||
- apiserver.crt |
|||
- apiserver.key |
|||
- apiserver-kubelet-client.crt |
|||
- apiserver-kubelet-client.key |
|||
- front-proxy-client.crt |
|||
- front-proxy-client.key |
|||
|
|||
- name: Generate new certs and keys |
|||
command: "{{ bin_dir }}/kubeadm init phase certs {{ item }} --config={{ kube_config_dir }}/kubeadm-config.yaml" |
|||
with_items: |
|||
- apiserver |
|||
- apiserver-kubelet-client |
|||
- front-proxy-client |
|||
when: inventory_hostname == groups['kube-master']|first and kubeadm_version is version('v1.13.0', '>=') |
|||
|
|||
- name: Generate new certs and keys |
|||
command: "{{ bin_dir }}/kubeadm alpha phase certs {{ item }} --config={{ kube_config_dir }}/kubeadm-config.yaml" |
|||
with_items: |
|||
- apiserver |
|||
- apiserver-kubelet-client |
|||
- front-proxy-client |
|||
when: inventory_hostname == groups['kube-master']|first and kubeadm_version is version('v1.13.0', '<') |
@ -0,0 +1,32 @@ |
|||
--- |
|||
- name: Backup old configuration files |
|||
copy: |
|||
src: "{{ kube_config_dir }}/{{ item.src }}" |
|||
dest: "{{ kube_config_dir }}/{{ item.dest }}" |
|||
remote_src: yes |
|||
with_items: |
|||
- {src: admin.conf, dest: admin.conf.old} |
|||
- {src: kubelet.conf, dest: kubelet.conf.old} |
|||
- {src: controller-manager.conf, dest: controller-manager.conf.old} |
|||
- {src: scheduler.conf, dest: scheduler.conf.old} |
|||
ignore_errors: yes |
|||
|
|||
- name: Remove old configuration files |
|||
file: |
|||
path: "{{ kube_config_dir }}/{{ item }}" |
|||
state: absent |
|||
with_items: |
|||
- admin.conf |
|||
- kubelet.conf |
|||
- controller-manager.conf |
|||
- scheduler.conf |
|||
|
|||
- name: Generate new configuration files |
|||
command: "{{ bin_dir }}/kubeadm init phase kubeconfig all --config={{ kube_config_dir }}/kubeadm-config.yaml" |
|||
when: kubeadm_version is version('v1.13.0', '>=') |
|||
ignore_errors: yes |
|||
|
|||
- name: Generate new configuration files |
|||
command: "{{ bin_dir }}/kubeadm alpha phase kubeconfig all --config={{ kube_config_dir }}/kubeadm-config.yaml" |
|||
when: kubeadm_version is version('v1.13.0', '<') |
|||
ignore_errors: yes |
Write
Preview
Loading…
Cancel
Save