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

相关推荐
灼烧的疯狂8 分钟前
K8S + Jenkins 做CICD
容器·kubernetes·jenkins
wenyue11211 小时前
Revolutionize Your Kubernetes Experience with Easegress: Kubernetes Gateway API
容器·kubernetes·gateway
O&REO5 小时前
单机部署kubernetes环境下Overleaf-基于MicroK8s的Overleaf应用部署指南
云原生·容器·kubernetes
运维小文6 小时前
K8S资源限制之LimitRange
云原生·容器·kubernetes·k8s资源限制
登云时刻6 小时前
Kubernetes集群外连接redis集群和使用redis-shake工具迁移数据(二)
redis·容器·kubernetes
wuxingge15 小时前
k8s1.30.0高可用集群部署
云原生·容器·kubernetes
志凌海纳SmartX16 小时前
趋势洞察|AI 能否带动裸金属 K8s 强势崛起?
云原生·容器·kubernetes
锅总16 小时前
nacos与k8s service健康检查详解
云原生·容器·kubernetes
BUG弄潮儿16 小时前
k8s 集群安装
云原生·容器·kubernetes
Code_Artist17 小时前
Docker镜像加速解决方案:配置HTTP代理,让Docker学会科学上网!
docker·云原生·容器