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
|
``` bash
|
||||||
# 比如创建nfs provisioner
|
# 比如创建nfs provisioner
|
||||||
storage_nfs_enabled: "yes"
|
storage:
|
||||||
nfs_server: "192.168.1.8"
|
nfs:
|
||||||
nfs_server_path: "/data/nfs"
|
enabled: "yes"
|
||||||
nfs_storage_class: "class-nfs-01"
|
server: "192.168.1.8"
|
||||||
nfs_provisioner_name: "nfs-provisioner-01"
|
server_path: "/data/nfs"
|
||||||
|
storage_class: "class-nfs-01"
|
||||||
|
provisioner_name: "nfs-provisioner-01"
|
||||||
```
|
```
|
||||||
- 3.创建 nfs provisioner
|
- 3.创建 nfs provisioner
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ es0 es1 es2
|
||||||
|
|
||||||
#### 使用动态 PV安装 EFK
|
#### 使用动态 PV安装 EFK
|
||||||
|
|
||||||
- 首先根据[这里](nfs-client.md)创建nfs-client-provisioner
|
- 首先根据[集群存储](../08-cluster-storage.md)创建nfs-client-provisioner
|
||||||
- 然后按实际需求修改 `es-dynamic-pv/es-statefulset.yaml` 文件中 volumeClaimTemplates 设置的 storage: 4Gi 大小
|
- 然后按实际需求修改 `es-dynamic-pv/es-statefulset.yaml` 文件中 volumeClaimTemplates 设置的 storage: 4Gi 大小
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
- helm
|
- helm
|
||||||
为了简化部署,通过helm来安装Jenkins,可参考文档:[helm](helm.md)
|
为了简化部署,通过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 Controller(nginx-ingress/traefik)
|
||||||
默认是通过Ingress访问Jenkins,因此需要安装一种`Ingress Controller`。参考文档:[ingress](ingress.md)
|
默认是通过Ingress访问Jenkins,因此需要安装一种`Ingress Controller`。参考文档:[ingress](ingress.md)
|
||||||
- Gitlab 代码管理仓库
|
- Gitlab 代码管理仓库
|
||||||
|
@ -175,4 +177,4 @@ http://admin:a910b1492e39e9dd1ea48ea7f7638aaf@jenkins.local.com/project/k8s-test
|
||||||
- 使用`kubectl`容器,部署`k8s-example`应用(这里后面也可以使用helm)
|
- 使用`kubectl`容器,部署`k8s-example`应用(这里后面也可以使用helm)
|
||||||
|
|
||||||
访问:
|
访问:
|
||||||
项目通过Ingress访问`k8s-example.com`,出现`hello, world`,就表示服务部署成功了。
|
项目通过Ingress访问`k8s-example.com`,出现`hello, world`,就表示服务部署成功了。
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
# 动态存储类型, 目前支持自建nfs和aliyun_nas
|
# 动态存储类型, 目前支持自建nfs和aliyun_nas
|
||||||
storage_nfs_enabled: "no"
|
storage:
|
||||||
storage_aliyun_nas_enabled: "no"
|
# nfs server 参数
|
||||||
|
nfs:
|
||||||
|
enabled: "no"
|
||||||
|
server: "172.16.3.86"
|
||||||
|
server_path: "/data/nfs"
|
||||||
|
storage_class: "nfs-dynamic-class"
|
||||||
|
provisioner_name: "nfs-provisioner-01"
|
||||||
|
|
||||||
# nfs server 参数
|
# aliyun_nas 参数
|
||||||
nfs_server: "192.168.1.8"
|
aliyun_nas:
|
||||||
nfs_server_path: "/data/nfs"
|
enabled: "no"
|
||||||
nfs_storage_class: "class-nfs-01"
|
server: "xxxxxxxxxxx.cn-hangzhou.nas.aliyuncs.com"
|
||||||
nfs_provisioner_name: "nfs-provisioner-01"
|
server_path: "/"
|
||||||
|
storage_class: "class-aliyun-nas-01"
|
||||||
# aliyun_nas 参数
|
controller_name: "aliyun-nas-controller-01"
|
||||||
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"
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
- name: 生成alicloud-nas动态存储配置
|
- name: 生成alicloud-nas动态存储配置
|
||||||
template:
|
template:
|
||||||
src: alicloud-nas/alicloud-nas.yaml.j2
|
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配置
|
- name: 复制alicloud-disk配置
|
||||||
copy:
|
copy:
|
||||||
|
@ -15,4 +15,4 @@
|
||||||
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/alicloud-nas/alicloud-disk.yaml"
|
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/alicloud-nas/alicloud-disk.yaml"
|
||||||
|
|
||||||
- name: 开始部署alicloud-nas动态存储
|
- 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
|
- include: nfs-client.yml
|
||||||
when: 'storage_nfs_enabled == "yes"'
|
when: 'storage.nfs.enabled == "yes"'
|
||||||
|
|
||||||
- include: alicloud-nas.yml
|
- include: alicloud-nas.yml
|
||||||
when: 'storage_aliyun_nas_enabled == "yes"'
|
when: 'storage.aliyun_nas.enabled == "yes"'
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
- name: 生成nfs-client动态存储配置
|
- name: 生成nfs-client动态存储配置
|
||||||
template:
|
template:
|
||||||
src: nfs/nfs-client-provisioner.yaml.j2
|
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动态存储
|
- 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
|
apiVersion: storage.k8s.io/v1
|
||||||
kind: StorageClass
|
kind: StorageClass
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ aliyun_nas_storage_class }}
|
name: {{ storage.aliyun_nas.storage_class }}
|
||||||
provisioner: alicloud/nas
|
provisioner: alicloud/nas
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
@ -26,7 +26,7 @@ roleRef:
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
apiVersion: apps/v1beta1
|
apiVersion: apps/v1beta1
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ aliyun_nas_controller_name }}
|
name: {{ storage.aliyun_nas.controller_name }}
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
@ -35,7 +35,7 @@ spec:
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: {{ aliyun_nas_controller_name }}
|
app: {{ storage.aliyun_nas.controller_name }}
|
||||||
spec:
|
spec:
|
||||||
serviceAccount: alicloud-nas-controller
|
serviceAccount: alicloud-nas-controller
|
||||||
containers:
|
containers:
|
||||||
|
@ -48,11 +48,11 @@ spec:
|
||||||
- name: PROVISIONER_NAME
|
- name: PROVISIONER_NAME
|
||||||
value: alicloud/nas
|
value: alicloud/nas
|
||||||
- name: NFS_SERVER
|
- name: NFS_SERVER
|
||||||
value: {{ aliyun_nas_server }}
|
value: {{ storage.aliyun_nas.server }}
|
||||||
- name: NFS_PATH
|
- name: NFS_PATH
|
||||||
value: {{ aliyun_nas_server_path }}
|
value: {{ storage.aliyun_nas.server_path }}
|
||||||
volumes:
|
volumes:
|
||||||
- name: nfs-client-root
|
- name: nfs-client-root
|
||||||
nfs:
|
nfs:
|
||||||
server: {{ aliyun_nas_server }}
|
server: {{ storage.aliyun_nas.server }}
|
||||||
path: {{ aliyun_nas_server_path }}
|
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
|
kind: Deployment
|
||||||
apiVersion: apps/v1beta1
|
apiVersion: apps/v1beta1
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ nfs_provisioner_name }}
|
name: {{ storage.nfs.provisioner_name }}
|
||||||
namespace: kube-system
|
namespace: kube-system
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
@ -49,11 +49,11 @@ spec:
|
||||||
type: Recreate
|
type: Recreate
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: {{ nfs_provisioner_name }}
|
app: {{ storage.nfs.provisioner_name }}
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: {{ nfs_provisioner_name }}
|
app: {{ storage.nfs.provisioner_name }}
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: nfs-client-provisioner
|
serviceAccountName: nfs-client-provisioner
|
||||||
containers:
|
containers:
|
||||||
|
@ -67,21 +67,21 @@ spec:
|
||||||
env:
|
env:
|
||||||
- name: PROVISIONER_NAME
|
- name: PROVISIONER_NAME
|
||||||
# 此处供应者名字供storageclass调用
|
# 此处供应者名字供storageclass调用
|
||||||
value: {{ nfs_provisioner_name }}
|
value: {{ storage.nfs.provisioner_name }}
|
||||||
- name: NFS_SERVER
|
- name: NFS_SERVER
|
||||||
value: {{ nfs_server }}
|
value: {{ storage.nfs.server }}
|
||||||
- name: NFS_PATH
|
- name: NFS_PATH
|
||||||
value: {{ nfs_server_path }}
|
value: {{ storage.nfs.server_path }}
|
||||||
volumes:
|
volumes:
|
||||||
- name: nfs-client-root
|
- name: nfs-client-root
|
||||||
nfs:
|
nfs:
|
||||||
server: {{ nfs_server }}
|
server: {{ storage.nfs.server }}
|
||||||
path: {{ nfs_server_path }}
|
path: {{ storage.nfs.server_path }}
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: storage.k8s.io/v1
|
apiVersion: storage.k8s.io/v1
|
||||||
kind: StorageClass
|
kind: StorageClass
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ nfs_storage_class }}
|
name: {{ storage.nfs.storage_class }}
|
||||||
provisioner: {{ nfs_provisioner_name }}
|
provisioner: {{ storage.nfs.provisioner_name }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue