mirror of https://github.com/easzlab/kubeasz.git
commit
d4a130a59a
|
@ -1,6 +0,0 @@
|
|||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: nfs-dynamic-class
|
||||
#此处引用nfs-client-provisioner里面的 nfs-prov-1
|
||||
provisioner: nfs-prov-1
|
|
@ -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/
|
|
@ -3,7 +3,7 @@ apiVersion: v1
|
|||
metadata:
|
||||
name: test-claim
|
||||
spec:
|
||||
storageClassName: nfs-dynamic-class
|
||||
storageClassName: alicloud-nas
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
|
@ -3,7 +3,7 @@ apiVersion: v1
|
|||
metadata:
|
||||
name: test
|
||||
spec:
|
||||
storageClassName: nfs-dynamic-class
|
||||
storageClassName: alicloud-nas
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
|
@ -1,12 +1,12 @@
|
|||
#-------------kube-dns 插件参数初始化
|
||||
# kubedns.yaml文件中部分参数根据hosts文件设置而定,因此需要用template模块替换参数
|
||||
- name: 准备 kubedns的部署文件 kubedns.yaml
|
||||
template: src=kubedns.yaml.j2 dest={{ base_dir }}/manifests/kubedns/kubedns.yaml
|
||||
template: src=dns/kubedns.yaml.j2 dest={{ base_dir }}/manifests/kubedns/kubedns.yaml
|
||||
when: "hostvars[inventory_hostname]['group_names'].count('deploy') == 1"
|
||||
|
||||
# coredns.yaml文件中部分参数根据hosts文件设置而定,因此需要用template模块替换参数
|
||||
- name: 准备 coredns的部署文件 coredns.yaml
|
||||
template: src=coredns.yaml.j2 dest={{ base_dir }}/manifests/coredns/coredns.yaml
|
||||
template: src=dns/coredns.yaml.j2 dest={{ base_dir }}/manifests/coredns/coredns.yaml
|
||||
when: "hostvars[inventory_hostname]['group_names'].count('deploy') == 1"
|
||||
|
||||
- name: 获取所有已经创建的POD信息
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -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"
|
|
@ -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 }}
|
|
@ -0,0 +1,5 @@
|
|||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: {{ storage_class_name }}
|
||||
provisioner: prov
|
|
@ -67,15 +67,13 @@ spec:
|
|||
env:
|
||||
- name: PROVISIONER_NAME
|
||||
# 此处供应者名字供storageclass调用
|
||||
value: nfs-prov-1
|
||||
value: prov
|
||||
- name: NFS_SERVER
|
||||
value: 10.1.241.230
|
||||
value: {{ storage_server }}
|
||||
- name: NFS_PATH
|
||||
value: /home/share/k8s-pv
|
||||
value: {{ storage_path }}
|
||||
volumes:
|
||||
- name: nfs-client-root
|
||||
nfs:
|
||||
server: 10.1.241.230
|
||||
path: /home/share/k8s-pv
|
||||
|
||||
---
|
||||
server: {{ storage_server }}
|
||||
path: {{ storage_path }}
|
Loading…
Reference in New Issue