mirror of https://github.com/easzlab/kubeasz.git
34 lines
1.4 KiB
YAML
34 lines
1.4 KiB
YAML
- name: 准备kube-scheduler 证书签名请求
|
|
template: src=kube-scheduler-csr.json.j2 dest={{ cluster_dir }}/ssl/kube-scheduler-csr.json
|
|
|
|
- name: 创建 kube-scheduler证书与私钥
|
|
shell: "cd {{ cluster_dir }}/ssl && {{ base_dir }}/bin/cfssl gencert \
|
|
-ca=ca.pem \
|
|
-ca-key=ca-key.pem \
|
|
-config=ca-config.json \
|
|
-profile=kubernetes kube-scheduler-csr.json | {{ base_dir }}/bin/cfssljson -bare kube-scheduler"
|
|
|
|
- name: 设置集群参数
|
|
shell: "{{ base_dir }}/bin/kubectl config set-cluster kubernetes \
|
|
--certificate-authority={{ cluster_dir }}/ssl/ca.pem \
|
|
--embed-certs=true \
|
|
--server={{ KUBE_APISERVER }} \
|
|
--kubeconfig={{ cluster_dir }}/kube-scheduler.kubeconfig"
|
|
|
|
- name: 设置认证参数
|
|
shell: "{{ base_dir }}/bin/kubectl config set-credentials system:kube-scheduler \
|
|
--client-certificate={{ cluster_dir }}/ssl/kube-scheduler.pem \
|
|
--client-key={{ cluster_dir }}/ssl/kube-scheduler-key.pem \
|
|
--embed-certs=true \
|
|
--kubeconfig={{ cluster_dir }}/kube-scheduler.kubeconfig"
|
|
|
|
- name: 设置上下文参数
|
|
shell: "{{ base_dir }}/bin/kubectl config set-context default \
|
|
--cluster=kubernetes \
|
|
--user=system:kube-scheduler \
|
|
--kubeconfig={{ cluster_dir }}/kube-scheduler.kubeconfig"
|
|
|
|
- name: 选择默认上下文
|
|
shell: "{{ base_dir }}/bin/kubectl config use-context default \
|
|
--kubeconfig={{ cluster_dir }}/kube-scheduler.kubeconfig"
|