当前位置: 首页 > article >正文

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


http://www.kler.cn/a/384732.html

相关文章:

  • 爬虫-------字体反爬
  • 软件设计师-上午题-14 信息安全(5分)
  • Android View事件分发
  • 【提效工具开发】Python功能模块执行和 SQL 执行 需求整理
  • C++总结
  • Axure设计之左右滚动组件教程(动态面板)
  • playground.tensorflow神经网络可视化工具
  • Python 5个数据容器
  • nodeJS程序如何引入依赖包
  • Fortran安装(vscode+gcc+Python)
  • github和Visual Studio
  • Python并发编程库:Asyncio的异步编程实战
  • 智慧城市智慧城市项目方案-大数据平台建设技术方案(原件Word)
  • 如何学习Java“高并发”,并在项目中实际应用?
  • uniapp(API-Promise 化)
  • 华为云前台网络是如何使用,功能有哪些?
  • 发现个免费建站免费体验模板使用的地方(腾讯云上)
  • DQN详解
  • 分享大模型发展进入新阶段,产业应用成为竞争焦点
  • 80后聊架构:架构设计中两个重要指标,延时与吞吐量(Latency vs Throughput) | 架构师之路...
  • Java链表及源码解析
  • 鸿蒙next选择 Flutter 开发跨平台应用的原因
  • 探索 Java 中 String 类的常用方法
  • MySQL分区表(二)
  • 2024-11-07 问AI: [AI面试题] 解释推荐系统的概念
  • WorkFlow源码剖析——Communicator之TCPServer(中)