From 70dc222719712d518034b5d0b9d3dfcb45add0eb Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Tue, 16 Jul 2019 15:27:26 +0300 Subject: [PATCH] Upgrade local volume provisioner to v2.3.2 (#4983) --- .../sample/group_vars/k8s-cluster/addons.yml | 2 ++ roles/download/defaults/main.yml | 2 +- .../local_volume_provisioner/README.md | 15 ++++++++++++++- .../local_volume_provisioner/defaults/main.yml | 7 +++++-- .../local_volume_provisioner/tasks/main.yml | 1 + .../local-volume-provisioner-clusterrole.yml.j2 | 10 ++++++++++ ...l-volume-provisioner-clusterrolebinding.yml.j2 | 15 +++++++-------- roles/kubespray-defaults/defaults/main.yaml | 7 +++++-- 8 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 roles/kubernetes-apps/external_provisioner/local_volume_provisioner/templates/local-volume-provisioner-clusterrole.yml.j2 diff --git a/inventory/sample/group_vars/k8s-cluster/addons.yml b/inventory/sample/group_vars/k8s-cluster/addons.yml index cdb501cf1..663a9dc9c 100644 --- a/inventory/sample/group_vars/k8s-cluster/addons.yml +++ b/inventory/sample/group_vars/k8s-cluster/addons.yml @@ -35,6 +35,8 @@ local_volume_provisioner_enabled: false # local-storage: # host_dir: /mnt/disks # mount_dir: /mnt/disks +# volume_mode: Filesystem +# fs_type: ext4 # fast-disks: # host_dir: /mnt/fast-disks # mount_dir: /mnt/fast-disks diff --git a/roles/download/defaults/main.yml b/roles/download/defaults/main.yml index 7ff0bf384..2f62f3d41 100644 --- a/roles/download/defaults/main.yml +++ b/roles/download/defaults/main.yml @@ -271,7 +271,7 @@ metrics_server_version: "v0.3.3" metrics_server_image_repo: "gcr.io/google_containers/metrics-server-amd64" metrics_server_image_tag: "{{ metrics_server_version }}" local_volume_provisioner_image_repo: "quay.io/external_storage/local-volume-provisioner" -local_volume_provisioner_image_tag: "v2.1.0" +local_volume_provisioner_image_tag: "v2.3.2" cephfs_provisioner_image_repo: "quay.io/external_storage/cephfs-provisioner" cephfs_provisioner_image_tag: "v2.1.0-k8s1.11" rbd_provisioner_image_repo: "quay.io/external_storage/rbd-provisioner" diff --git a/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/README.md b/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/README.md index c1d2817d7..334c9dae3 100644 --- a/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/README.md +++ b/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/README.md @@ -72,6 +72,19 @@ mount /dev/vdb1 /mnt/disks/ssd1 Physical disks are recommended for production environments because it offers complete isolation in terms of I/O and capacity. +### Mount unpartitioned physical devices + + +``` bash +for disk in /dev/sdc /dev/sdd /dev/sde; do + ln -s $disk /mnt/disks +done +``` + +This saves time of precreatnig filesystems. Note that your storageclass must have +volume_mode set to "Filesystem" and fs_type defined. If either is not set, the +disk will be added as a raw block device. + ### File-backed sparsefile method ``` bash @@ -92,7 +105,7 @@ management. ### Block volumeMode PVs Create a symbolic link under discovery directory to the block device on the node. To use -raw block devices in pods BlockVolume feature gate must be enabled. +raw block devices in pods, volume_type should be set to "Block". Usage notes ----------- diff --git a/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/defaults/main.yml b/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/defaults/main.yml index d0a5a9846..c9a2b5c75 100644 --- a/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/defaults/main.yml +++ b/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/defaults/main.yml @@ -5,7 +5,10 @@ local_volume_provisioner_namespace: "kube-system" local_volume_provisioner_storage_classes: | { "{{ local_volume_provisioner_storage_class | default('local-storage') }}": { - "host_dir": "{{ local_volume_provisioner_base_dir | default ('/mnt/disks') }}", - "mount_dir": "{{ local_volume_provisioner_mount_dir | default('/mnt/disks') }}" + "host_dir": "{{ local_volume_provisioner_base_dir | default ('/mnt/disks') }}", + "mount_dir": "{{ local_volume_provisioner_mount_dir | default('/mnt/disks') }}", + "volume_mode": "Filesystem", + "fs_type": "ext4" + } } diff --git a/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/tasks/main.yml b/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/tasks/main.yml index 57994468c..862084b7b 100644 --- a/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/tasks/main.yml +++ b/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/tasks/main.yml @@ -24,6 +24,7 @@ local_volume_provisioner_templates: - { name: local-volume-provisioner-ns, file: local-volume-provisioner-ns.yml, type: ns } - { name: local-volume-provisioner-sa, file: local-volume-provisioner-sa.yml, type: sa } + - { name: local-volume-provisioner-clusterrole, file: local-volume-provisioner-clusterrole.yml, type: clusterrole } - { name: local-volume-provisioner-clusterrolebinding, file: local-volume-provisioner-clusterrolebinding.yml, type: clusterrolebinding } - { name: local-volume-provisioner-cm, file: local-volume-provisioner-cm.yml, type: cm } - { name: local-volume-provisioner-ds, file: local-volume-provisioner-ds.yml, type: ds } diff --git a/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/templates/local-volume-provisioner-clusterrole.yml.j2 b/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/templates/local-volume-provisioner-clusterrole.yml.j2 new file mode 100644 index 000000000..e4348b123 --- /dev/null +++ b/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/templates/local-volume-provisioner-clusterrole.yml.j2 @@ -0,0 +1,10 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: local-volume-provisioner-node-clusterrole + namespace: {{ local_volume_provisioner_namespace }} +rules: +- apiGroups: [""] + resources: ["nodes"] + verbs: ["get"] diff --git a/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/templates/local-volume-provisioner-clusterrolebinding.yml.j2 b/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/templates/local-volume-provisioner-clusterrolebinding.yml.j2 index ab98f1f55..aafd88f00 100644 --- a/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/templates/local-volume-provisioner-clusterrolebinding.yml.j2 +++ b/roles/kubernetes-apps/external_provisioner/local_volume_provisioner/templates/local-volume-provisioner-clusterrolebinding.yml.j2 @@ -5,14 +5,13 @@ metadata: name: local-volume-provisioner-system-persistent-volume-provisioner namespace: {{ local_volume_provisioner_namespace }} subjects: - - kind: ServiceAccount - name: local-volume-provisioner - namespace: {{ local_volume_provisioner_namespace }} +- kind: ServiceAccount + name: local-volume-provisioner + namespace: {{ local_volume_provisioner_namespace }} roleRef: kind: ClusterRole name: system:persistent-volume-provisioner apiGroup: rbac.authorization.k8s.io - --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding @@ -20,10 +19,10 @@ metadata: name: local-volume-provisioner-system-node namespace: {{ local_volume_provisioner_namespace }} subjects: - - kind: ServiceAccount - name: local-volume-provisioner - namespace: {{ local_volume_provisioner_namespace }} +- kind: ServiceAccount + name: local-volume-provisioner + namespace: {{ local_volume_provisioner_namespace }} roleRef: kind: ClusterRole - name: system:node + name: local-volume-provisioner-node-clusterrole apiGroup: rbac.authorization.k8s.io diff --git a/roles/kubespray-defaults/defaults/main.yaml b/roles/kubespray-defaults/defaults/main.yaml index 2a5a0202a..f20bdf346 100644 --- a/roles/kubespray-defaults/defaults/main.yaml +++ b/roles/kubespray-defaults/defaults/main.yaml @@ -362,8 +362,11 @@ kubeadm_control_plane: false local_volume_provisioner_storage_classes: | { "{{ local_volume_provisioner_storage_class | default('local-storage') }}": { - "host_dir": "{{ local_volume_provisioner_base_dir | default ('/mnt/disks') }}", - "mount_dir": "{{ local_volume_provisioner_mount_dir | default('/mnt/disks') }}" + "host_dir": "{{ local_volume_provisioner_base_dir | default ('/mnt/disks') }}", + "mount_dir": "{{ local_volume_provisioner_mount_dir | default('/mnt/disks') }}", + "volume_mode": "Filesystem", + "fs_type": "ext4" + } }