mirror of https://github.com/easzlab/kubeasz.git
parent
b24626513f
commit
50862bcaaf
|
@ -51,11 +51,13 @@ $ ansible-playbook /etc/ansible/tools/init_vars.yml
|
|||
|
||||
``` bash
|
||||
# 比如创建nfs provisioner
|
||||
storage_nfs_enabled: "yes"
|
||||
nfs_server: "192.168.1.8"
|
||||
nfs_server_path: "/data/nfs"
|
||||
nfs_storage_class: "class-nfs-01"
|
||||
nfs_provisioner_name: "nfs-provisioner-01"
|
||||
storage:
|
||||
nfs:
|
||||
enabled: "yes"
|
||||
server: "192.168.1.8"
|
||||
server_path: "/data/nfs"
|
||||
storage_class: "class-nfs-01"
|
||||
provisioner_name: "nfs-provisioner-01"
|
||||
```
|
||||
- 3.创建 nfs provisioner
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ es0 es1 es2
|
|||
|
||||
#### 使用动态 PV安装 EFK
|
||||
|
||||
- 首先根据[这里](nfs-client.md)创建nfs-client-provisioner
|
||||
- 首先根据[集群存储](../08-cluster-storage.md)创建nfs-client-provisioner
|
||||
- 然后按实际需求修改 `es-dynamic-pv/es-statefulset.yaml` 文件中 volumeClaimTemplates 设置的 storage: 4Gi 大小
|
||||
|
||||
``` bash
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
- helm
|
||||
为了简化部署,通过helm来安装Jenkins,可参考文档:[helm](helm.md)
|
||||
- 持久化存储
|
||||
这里使用**NFS**演示,参考文档:[nfs-client](nfs-client.md)。如果k8s集群是部署在公有云,也可使用厂商的NAS等存储方案,具体参考相关厂商文档
|
||||
这里使用**NFS**演示,参考文档:[cluster-storage](../08-cluster-storage.md)。
|
||||
如果k8s集群是部署在公有云,也可使用厂商的NAS等存储方案,项目中已集成支持阿里云NAS,其他的方案参考相关厂商文档
|
||||
|
||||
- Ingress Controller(nginx-ingress/traefik)
|
||||
默认是通过Ingress访问Jenkins,因此需要安装一种`Ingress Controller`。参考文档:[ingress](ingress.md)
|
||||
- Gitlab 代码管理仓库
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
# 动态存储类型, 目前支持自建nfs和aliyun_nas
|
||||
storage_nfs_enabled: "no"
|
||||
storage_aliyun_nas_enabled: "no"
|
||||
|
||||
storage:
|
||||
# nfs server 参数
|
||||
nfs_server: "192.168.1.8"
|
||||
nfs_server_path: "/data/nfs"
|
||||
nfs_storage_class: "class-nfs-01"
|
||||
nfs_provisioner_name: "nfs-provisioner-01"
|
||||
nfs:
|
||||
enabled: "no"
|
||||
server: "172.16.3.86"
|
||||
server_path: "/data/nfs"
|
||||
storage_class: "nfs-dynamic-class"
|
||||
provisioner_name: "nfs-provisioner-01"
|
||||
|
||||
# aliyun_nas 参数
|
||||
aliyun_nas_server: "172.16.3.86"
|
||||
aliyun_nas_server_path: "/data/nas"
|
||||
aliyun_nas_storage_class: "class-aliyun-nas-01"
|
||||
aliyun_nas_controller_name: "aliyun-nas-controller-01"
|
||||
aliyun_nas:
|
||||
enabled: "no"
|
||||
server: "xxxxxxxxxxx.cn-hangzhou.nas.aliyuncs.com"
|
||||
server_path: "/"
|
||||
storage_class: "class-aliyun-nas-01"
|
||||
controller_name: "aliyun-nas-controller-01"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
- name: 生成alicloud-nas动态存储配置
|
||||
template:
|
||||
src: alicloud-nas/alicloud-nas.yaml.j2
|
||||
dest: "{{ base_dir }}/manifests/storage/alicloud-nas/{{ aliyun_nas_controller_name }}.yaml"
|
||||
dest: "{{ base_dir }}/manifests/storage/alicloud-nas/{{ storage.aliyun_nas.controller_name }}.yaml"
|
||||
|
||||
- name: 复制alicloud-disk配置
|
||||
copy:
|
||||
|
@ -15,4 +15,4 @@
|
|||
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/{{ aliyun_nas_controller_name }}.yaml"
|
||||
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/alicloud-nas/{{ storage.aliyun_nas.controller_name }}.yaml"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- include: nfs-client.yml
|
||||
when: 'storage_nfs_enabled == "yes"'
|
||||
when: 'storage.nfs.enabled == "yes"'
|
||||
|
||||
- include: alicloud-nas.yml
|
||||
when: 'storage_aliyun_nas_enabled == "yes"'
|
||||
when: 'storage.aliyun_nas.enabled == "yes"'
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
- name: 生成nfs-client动态存储配置
|
||||
template:
|
||||
src: nfs/nfs-client-provisioner.yaml.j2
|
||||
dest: "{{ base_dir }}/manifests/storage/nfs/{{ nfs_provisioner_name }}.yaml"
|
||||
dest: "{{ base_dir }}/manifests/storage/nfs/{{ storage.nfs.provisioner_name }}.yaml"
|
||||
|
||||
- name: 开始部署nfs-client动态存储
|
||||
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/nfs/{{ nfs_provisioner_name }}.yaml"
|
||||
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/nfs/{{ storage.nfs.provisioner_name }}.yaml"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: {{ aliyun_nas_storage_class }}
|
||||
name: {{ storage.aliyun_nas.storage_class }}
|
||||
provisioner: alicloud/nas
|
||||
---
|
||||
apiVersion: v1
|
||||
|
@ -26,7 +26,7 @@ roleRef:
|
|||
kind: Deployment
|
||||
apiVersion: apps/v1beta1
|
||||
metadata:
|
||||
name: {{ aliyun_nas_controller_name }}
|
||||
name: {{ storage.aliyun_nas.controller_name }}
|
||||
namespace: kube-system
|
||||
spec:
|
||||
replicas: 1
|
||||
|
@ -35,7 +35,7 @@ spec:
|
|||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ aliyun_nas_controller_name }}
|
||||
app: {{ storage.aliyun_nas.controller_name }}
|
||||
spec:
|
||||
serviceAccount: alicloud-nas-controller
|
||||
containers:
|
||||
|
@ -48,11 +48,11 @@ spec:
|
|||
- name: PROVISIONER_NAME
|
||||
value: alicloud/nas
|
||||
- name: NFS_SERVER
|
||||
value: {{ aliyun_nas_server }}
|
||||
value: {{ storage.aliyun_nas.server }}
|
||||
- name: NFS_PATH
|
||||
value: {{ aliyun_nas_server_path }}
|
||||
value: {{ storage.aliyun_nas.server_path }}
|
||||
volumes:
|
||||
- name: nfs-client-root
|
||||
nfs:
|
||||
server: {{ aliyun_nas_server }}
|
||||
path: {{ aliyun_nas_server_path }}
|
||||
server: {{ storage.aliyun_nas.server }}
|
||||
path: {{ storage.aliyun_nas.server_path }}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: {{ storage_class_name }}
|
||||
provisioner: prov
|
|
@ -41,7 +41,7 @@ roleRef:
|
|||
kind: Deployment
|
||||
apiVersion: apps/v1beta1
|
||||
metadata:
|
||||
name: {{ nfs_provisioner_name }}
|
||||
name: {{ storage.nfs.provisioner_name }}
|
||||
namespace: kube-system
|
||||
spec:
|
||||
replicas: 1
|
||||
|
@ -49,11 +49,11 @@ spec:
|
|||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ nfs_provisioner_name }}
|
||||
app: {{ storage.nfs.provisioner_name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ nfs_provisioner_name }}
|
||||
app: {{ storage.nfs.provisioner_name }}
|
||||
spec:
|
||||
serviceAccountName: nfs-client-provisioner
|
||||
containers:
|
||||
|
@ -67,21 +67,21 @@ spec:
|
|||
env:
|
||||
- name: PROVISIONER_NAME
|
||||
# 此处供应者名字供storageclass调用
|
||||
value: {{ nfs_provisioner_name }}
|
||||
value: {{ storage.nfs.provisioner_name }}
|
||||
- name: NFS_SERVER
|
||||
value: {{ nfs_server }}
|
||||
value: {{ storage.nfs.server }}
|
||||
- name: NFS_PATH
|
||||
value: {{ nfs_server_path }}
|
||||
value: {{ storage.nfs.server_path }}
|
||||
volumes:
|
||||
- name: nfs-client-root
|
||||
nfs:
|
||||
server: {{ nfs_server }}
|
||||
path: {{ nfs_server_path }}
|
||||
server: {{ storage.nfs.server }}
|
||||
path: {{ storage.nfs.server_path }}
|
||||
|
||||
---
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: {{ nfs_storage_class }}
|
||||
provisioner: {{ nfs_provisioner_name }}
|
||||
name: {{ storage.nfs.storage_class }}
|
||||
provisioner: {{ storage.nfs.provisioner_name }}
|
||||
|
||||
|
|
Loading…
Reference in New Issue