forked from easzlab/kubeasz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' of https://github.com/Hello-Linux/kubeasz into dev
- Loading branch information
Showing
18 changed files
with
275 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 个性化集群参数配置 | ||
|
||
`kubeasz`创建集群主要在以下两个地方进行配置: | ||
|
||
- ansible hosts 文件(模板在examples目录):集群主要节点定义和主要参数配置 | ||
- roles/xxx/vars/main.yml 文件:其他参数配置或者部分组件参数配置 | ||
|
||
这些文件都在.gitignore忽略范围,因此修改后项目目录能够保持`git status | clean` | ||
|
||
## ansible hosts | ||
|
||
项目尽量保持`ansible hosts`简单、灵活,在[快速指南](../quickStart.md)或者[集群规划与安装概览](../00-集群规划和基础参数设定.md)已经介绍过,主要包括集群节点定义和集群范围的主要参数配置;目前提供三种集群部署模板。 | ||
|
||
尽量保持配置项稳定。 | ||
|
||
## roles/xxx/vars/main.yml | ||
|
||
主要包括集群某个具体组件的个性化配置,具体组件的配置项可能会不断增加;项目初始时该配置与 roles/xxx/defaults/main.yml 一致,确保在不做任何配置情况下可以使用默认值创建集群;因 ansilbe 变量优先级关系,后续如果对 roles/xxx/vars/main.yml变量修改,那么它将覆盖默认配置。 | ||
|
This file was deleted.
Oops, something went wrong.
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,99 @@ | ||
kind: StorageClass | ||
apiVersion: storage.k8s.io/v1beta1 | ||
metadata: | ||
name: alicloud-disk-common | ||
provisioner: alicloud/disk | ||
parameters: | ||
type: cloud | ||
--- | ||
kind: StorageClass | ||
apiVersion: storage.k8s.io/v1beta1 | ||
metadata: | ||
name: alicloud-disk-efficiency | ||
provisioner: alicloud/disk | ||
parameters: | ||
type: cloud_efficiency | ||
--- | ||
kind: StorageClass | ||
apiVersion: storage.k8s.io/v1beta1 | ||
metadata: | ||
name: alicloud-disk-ssd | ||
provisioner: alicloud/disk | ||
parameters: | ||
type: cloud_ssd | ||
--- | ||
kind: StorageClass | ||
apiVersion: storage.k8s.io/v1beta1 | ||
metadata: | ||
name: alicloud-disk-available | ||
provisioner: alicloud/disk | ||
parameters: | ||
type: available | ||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
metadata: | ||
name: alicloud-disk-controller-runner | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["persistentvolumes"] | ||
verbs: ["get", "list", "watch", "create", "delete"] | ||
- apiGroups: [""] | ||
resources: ["persistentvolumeclaims"] | ||
verbs: ["get", "list", "watch", "update"] | ||
- apiGroups: ["storage.k8s.io"] | ||
resources: ["storageclasses"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: [""] | ||
resources: ["events"] | ||
verbs: ["list", "watch", "create", "update", "patch"] | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: alicloud-disk-controller | ||
namespace: kube-system | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
metadata: | ||
name: run-alicloud-disk-controller | ||
subjects: | ||
- kind: ServiceAccount | ||
name: alicloud-disk-controller | ||
namespace: kube-system | ||
roleRef: | ||
kind: ClusterRole | ||
name: alicloud-disk-controller-runner | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
kind: Deployment | ||
apiVersion: extensions/v1beta1 | ||
metadata: | ||
name: alicloud-disk-controller | ||
namespace: kube-system | ||
spec: | ||
replicas: 1 | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: alicloud-disk-controller | ||
spec: | ||
serviceAccount: alicloud-disk-controller | ||
containers: | ||
- name: alicloud-disk-controller | ||
image: registry.cn-hangzhou.aliyuncs.com/acs/alicloud-disk-controller:v1.9.3-ed710ce | ||
volumeMounts: | ||
- name: cloud-config | ||
mountPath: /etc/kubernetes/ | ||
- name: logdir | ||
mountPath: /var/log/alicloud/ | ||
volumes: | ||
- name: cloud-config | ||
hostPath: | ||
path: /etc/kubernetes/ | ||
- name: logdir | ||
hostPath: | ||
path: /var/log/alicloud/ |
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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,8 @@ | ||
- hosts: deploy | ||
roles: | ||
- cluster-storage | ||
vars: | ||
storage_type: nfs | ||
storage_server: 172.16.3.86 | ||
storage_path: /data/nfs | ||
storage_class_name: nfs-dynamic-class |
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,5 @@ | ||
# 动态存储类型, 目前支持nfs和alicloud-nas | ||
storage_type: nfs | ||
storage_server: 172.16.3.86 | ||
storage_path: /data/nfs | ||
storage_class_name: nfs-dynamic-class |
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,27 @@ | ||
- block: | ||
- name: 准备部署nfs-client动态存储 | ||
template: | ||
src: nfs/nfs-client-provisioner.yaml.j2 | ||
dest: "{{ base_dir }}/manifests/storage/nfs/nfs-client-provisioner.yaml" | ||
- name: 开始部署nfs-client动态存储 | ||
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/nfs/nfs-client-provisioner.yaml" | ||
when: 'storage_type == "nfs"' | ||
|
||
- block: | ||
- name: 准备部署alicloud-nas动态存储 | ||
template: | ||
src: alicloud-nas/alicloud-nas.yaml.j2 | ||
dest: "{{ base_dir }}/manifests/storage/alicloud-nas/alicloud-nas.yaml" | ||
- name: 开始部署alicloud-disk存储 | ||
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/alicloud-nas/alicloud-disk.yaml" | ||
- name: 开始部署alicloud-nas动态存储 | ||
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/alicloud-nas/alicloud-nas.yaml" | ||
when: 'storage_type == "alicloud-nas"' | ||
|
||
- block: | ||
- name: 准备部署动态存储类 | ||
template: | ||
src: dynamic-storageclass.yaml.j2 | ||
dest: "{{ base_dir }}/manifests/storage/dynamic-storageclass.yaml" | ||
- name: 开始部署动态存储类 | ||
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/dynamic-storageclass.yaml" |
58 changes: 58 additions & 0 deletions
58
roles/cluster-storage/templates/alicloud-nas/alicloud-nas.yaml.j2
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,58 @@ | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: alicloud-nas | ||
provisioner: alicloud/nas | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: alicloud-nas-controller | ||
namespace: kube-system | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
metadata: | ||
name: run-alicloud-nas-controller | ||
subjects: | ||
- kind: ServiceAccount | ||
name: alicloud-nas-controller | ||
namespace: kube-system | ||
roleRef: | ||
kind: ClusterRole | ||
name: alicloud-disk-controller-runner | ||
apiGroup: rbac.authorization.k8s.io | ||
--- | ||
kind: Deployment | ||
apiVersion: apps/v1beta1 | ||
metadata: | ||
name: alicloud-nas-controller | ||
namespace: kube-system | ||
spec: | ||
replicas: 1 | ||
strategy: | ||
type: Recreate | ||
template: | ||
metadata: | ||
labels: | ||
app: alicloud-nas-controller | ||
spec: | ||
serviceAccount: alicloud-nas-controller | ||
containers: | ||
- name: alicloud-nas-controller | ||
image: registry.cn-hangzhou.aliyuncs.com/acs/alicloud-nas-controller:v1.8.4 | ||
volumeMounts: | ||
- mountPath: /persistentvolumes | ||
name: nfs-client-root | ||
env: | ||
- name: PROVISIONER_NAME | ||
value: alicloud/nas | ||
- name: NFS_SERVER | ||
value: {{ storage_server }} | ||
- name: NFS_PATH | ||
value: {{ storage_path }} | ||
volumes: | ||
- name: nfs-client-root | ||
nfs: | ||
server: {{ storage_server }} | ||
path: {{ storage_path }} |
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,5 @@ | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: {{ storage_class_name }} | ||
provisioner: prov |
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,32 @@ | ||
# [可选]初始化集群设置脚本,使用请参考docs/op/config_guide.md | ||
# 如果创建集群时需要修改项目roles中默认配置,请执行本脚本后,编辑roles/xxx/vars/main.yml修改 | ||
|
||
- hosts: deploy | ||
tasks: | ||
- name: 创建变量配置目录 roles/xxx/vars | ||
file: name={{ base_dir }}/roles/{{ item }}/vars state=directory | ||
with_items: | ||
- calico | ||
- cluster-addon | ||
- cluster-restore | ||
- flannel | ||
- helm | ||
- kube-node | ||
- kube-router | ||
- lb | ||
|
||
- name: 复制默认配置以备修改 | ||
copy: | ||
src: "{{ base_dir }}/roles/{{ item }}/defaults/main.yml" | ||
dest: "{{ base_dir }}/roles/{{ item }}/vars/main.yml" | ||
force: "no" | ||
with_items: | ||
- calico | ||
- cluster-addon | ||
- cluster-restore | ||
- flannel | ||
- helm | ||
- kube-node | ||
- kube-router | ||
- lb | ||
|