Linux实战笔记-----Helm部署nfs-client-provisioner

首先要有个纯净的实验环境,将所有pvc、pv、sc 删除干净,拉取nfs-provisioner-v4.0.2镜像,上传至harbor
在这里插入图片描述
查找nfs-subdir-external-provisioner仓库

helm search hub nfs-subdir-external-provisioner

添加nfs-subdir-external-provisioner 到repo

helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/

拉取nfs-subdir-external-provisioner-4.0.12.tgz

helm  pull nfs-subdir-external-provisioner/nfs-subdir-external-provisioner

解压压缩包

cd nfs-subdir-external-provisioner
tar zxf nfs-subdir-external-provisioner-4.0.12.tgz 
cd nfs-subdir-external-provisioner/

修改values.yaml内容

replicaCount: 1
strategyType: Recreate

image:
  repository: sig-storage/nfs-subdir-external-provisioner
  tag: v4.0.2
  pullPolicy: IfNotPresent
imagePullSecrets: []

nfs:
  server: 172.25.13.1
  path: /mnt/nfs
  mountOptions:
  volumeName: nfs-subdir-external-provisioner-root

# For creating the StorageClass automatically:
storageClass:
  create: true

  # Set a provisioner name. If unset, a name will be generated.
  # provisionerName:

  # Set StorageClass as the default StorageClass
  # Ignored if storageClass.create is false
  defaultClass: true

  # Set a StorageClass name
  # Ignored if storageClass.create is false
  name: nfs-client

  # Allow volume to be expanded dynamically
  allowVolumeExpansion: true

  # Method used to reclaim an obsoleted volume
  reclaimPolicy: Delete

  # When set to false your PVs will not be archived by the provisioner upon deletion of the PVC.
  archiveOnDelete: false

  # If it exists and has 'delete' value, delete the directory. If it exists and has 'retain' value, save the directory.
  # Overrides archiveOnDelete.
  # Ignored if value not set.
  onDelete:

  # Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace.
  # Ignored if value not set.
  pathPattern:

  # Set access mode - ReadWriteOnce, ReadOnlyMany or ReadWriteMany
  accessModes: ReadWriteOnce

  # Storage class annotations
  annotations: {}

leaderElection:
  # When set to false leader election will be disabled
  enabled: true

## For RBAC support:
rbac:
  # Specifies whether RBAC resources should be created
  create: true

# If true, create & use Pod Security Policy resources
# https://kubernetes.io/docs/concepts/policy/pod-security-policy/
podSecurityPolicy:
  enabled: false

# Deployment pod annotations
podAnnotations: {}

## Set pod priorityClassName
# priorityClassName: ""

serviceAccount:
  # Specifies whether a ServiceAccount should be created
  create: true

  # Annotations to add to the service account
  annotations: {}

  # The name of the ServiceAccount to use.
  # If not set and create is true, a name is generated using the fullname template
  name:

resources: {}
  # limits:
  #  cpu: 100m
  #  memory: 128Mi
  # requests:
  #  cpu: 100m
  #  memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

# Additional labels for any resource created
labels: {}

部署nfs-client-provisioner,指定NAMESPACE: nfs-client-provisioner

helm install  nfs-client-provisioner . -n nfs-client-provisioner

查看部署信息

1. 通过 Helm Chart 安装 nfs-client-provisioner 使用 Helm Chart 安装 nfs-client-provisioner 可以很容易地创建多个实例。首先,需要安装 Helm 工具和 Tiller 服务。然后,可以使用以下命令安装 nfs-client-provisioner: ``` helm install --name nfs-client-provisioner-1 stable/nfs-client-provisioner \ --set nfs.server=<NFS server IP address> \ --set nfs.path=<NFS server path> \ --set storageClass.name=nfs-client-provisioner-1 \ --set storageClass.defaultClass=false \ --set storageClass.archiveOnDelete=false \ --set storageClass.reclaimPolicy=Retain \ --set resources.requests.storage=1Gi ``` 通过更改 `--name` 和 `storageClass.name` 参数的值,可以创建多个 nfs-client-provisioner 实例。 2. 使用 Kubernetes 部署多个 nfs-client-provisionerKubernetes 中,可以创建多个 nfs-client-provisioner 实例,每个实例都有自己的 Deployment、Service 和 StorageClass。可以使用以下 YAML 文件创建一个 nfs-client-provisioner 实例: ``` apiVersion: v1 kind: ServiceAccount metadata: name: nfs-client-provisioner --- kind: Deployment apiVersion: extensions/v1beta1 metadata: name: nfs-client-provisioner-1 spec: replicas: 1 selector: matchLabels: app: nfs-client-provisioner-1 template: metadata: labels: app: nfs-client-provisioner-1 spec: serviceAccountName: nfs-client-provisioner containers: - name: nfs-client-provisioner image: quay.io/external_storage/nfs-client-provisioner:latest volumeMounts: - name: nfs-client-root mountPath: /persistentvolumes env: - name: PROVISIONER_NAME value: nfs-client-provisioner-1 - name: NFS_SERVER value: <NFS server IP address> - name: NFS_PATH value: <NFS server path> volumes: - name: nfs-client-root nfs: server: <NFS server IP address> path: <NFS server path> --- kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: nfs-client-provisioner-1 provisioner: nfs-client-provisioner-1 reclaimPolicy: Retain parameters: archiveOnDelete: "false" mountOptions: "nfsvers=4.1" ``` 然后,可以将文件中的 `nfs-client-provisioner-1` 更改为另一个名称,以创建另一个 nfs-client-provisioner 实例。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值