K8s使用nfs

改动点

  1. ip和路径改为自己的


    apiVersion: v1
    kind: ServiceAccount
    metadata:
    name: nfs-client-provisioner

    replace with namespace where provisioner is deployed

    namespace: nfs-client

    kind: ClusterRole
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
    name: nfs-client-provisioner-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: ["create", "update", "patch"]

    kind: ClusterRoleBinding
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
    name: run-nfs-client-provisioner
    subjects:

    • kind: ServiceAccount
      name: nfs-client-provisioner

      replace with namespace where provisioner is deployed

      namespace: nfs-client
      roleRef:
      kind: ClusterRole
      name: nfs-client-provisioner-runner
      apiGroup: rbac.authorization.k8s.io

    kind: Role
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
    name: leader-locking-nfs-client-provisioner

    replace with namespace where provisioner is deployed

    namespace: nfs-client
    rules:

    • apiGroups: [""]
      resources: ["endpoints"]
      verbs: ["get", "list", "watch", "create", "update", "patch"]

    kind: RoleBinding
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
    name: leader-locking-nfs-client-provisioner

    replace with namespace where provisioner is deployed

    namespace: nfs-client
    subjects:

    • kind: ServiceAccount
      name: nfs-client-provisioner

      replace with namespace where provisioner is deployed

      namespace: nfs-client
      roleRef:
      kind: Role
      name: leader-locking-nfs-client-provisioner
      apiGroup: rbac.authorization.k8s.io

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
    name: managed-nfs-storage
    provisioner: k8s-sigs.io/nfs-subdir-external-provisioner # or choose another name, must match deployment's env PROVISIONER_NAME'
    parameters:
    archiveOnDelete: "false"


    apiVersion: apps/v1
    kind: Deployment
    metadata:
    name: nfs-client-provisioner
    labels:
    app: nfs-client-provisioner

    replace with namespace where provisioner is deployed

    namespace: nfs-client
    spec:
    replicas: 1
    strategy:
    type: Recreate
    selector:
    matchLabels:
    app: nfs-client-provisioner
    template:
    metadata:
    labels:
    app: nfs-client-provisioner
    spec:
    serviceAccountName: nfs-client-provisioner
    containers:
    - name: nfs-client-provisioner
    image: gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner:v4.0.0
    volumeMounts:
    - name: nfs-client-root
    mountPath: /persistentvolumes
    env:
    - name: PROVISIONER_NAME
    value: k8s-sigs.io/nfs-subdir-external-provisioner
    # value: fuseim.pri/ifs
    - name: NFS_SERVER
    value: 10.101.4.78
    - name: NFS_PATH
    value: /data/nfs/kubedata
    volumes:
    - name: nfs-client-root
    nfs:
    server: 10.101.4.78
    path: /data/nfs/kubedata

参考链接

https://www.cnblogs.com/lina-2159/p/16136317.html

相关推荐
高山莫衣7 小时前
Docker Desktop导致存储空间不足时的解决方案
docker·容器·eureka
鹏大师运维7 小时前
在银河麒麟V10 SP1上手动安装与配置高版本Docker的完整指南
linux·运维·docker·容器·麒麟·统信uos·中科方德
Ahlson7 小时前
【fnNAS】docker的nginx配置html
nginx·docker·容器·fnnas
LuckyLay7 小时前
Compose 常用命令详解——AI教你学Docker
docker·容器·eureka
moppol8 小时前
容器化 vs 虚拟机:什么时候该用 Docker?什么时候必须用 VM?
运维·docker·容器
没有名字的小羊8 小时前
7.可视化的docker界面——portainer
docker·容器·eureka
木头左10 小时前
Windows环境下Docker容器化的安装与设置指南
windows·docker·容器
&如歌的行板&11 小时前
如何在postman中动态请求k8s中的pod ip(基于nacos)
云原生·容器·kubernetes
泡泡_022411 小时前
云原生系统DOCKER中容器系统搭建
docker·云原生·容器
Changersh12 小时前
Windows下配置Docker+WSL集成开发环境
windows·docker·容器