• 注册
  • BBS
  • 今日 0
  • 帖子
  • 关注
    • 查看作者
    • K8s集群挂载nfs编排文件例子nfsvers3版本

      K8s集群挂载nfs编排文件例子nfsvers3版本

      cat pvc.yaml
      apiVersion: v1
      kind: PersistentVolume
      metadata:
        name: aaaupload-rw
        namespace: nginx-aaa
      spec:
        capacity:
          storage: 300Gi
        accessModes:
          - ReadWriteMany
        persistentVolumeReclaimPolicy: Retain
        mountOptions:
          - hard
          - nfsvers=3
          - noresvport
        nfs:
          path: /testfile
          server: xxxxxxxxxxxxxxx.nas.aliyuncs.com
      ---------------------------------------------------------------------------
      cat pv.yaml
      apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
        name: aaaupload-rw
        namespace: nginx-aaa
      spec:
        accessModes:
          - ReadWriteMany
        resources:
          requests:
            storage: 300Gi
            
      ---------------------------------------------------------------------------
            
      cat deployment.yaml
      apiVersion: extensions/v1beta1 
      kind: Deployment 
      metadata: 
        name: test-aaa1upload
        namespace: nginx-aaa
      spec: 
        replicas: 2
        strategy:
          type: RollingUpdate
          rollingUpdate:
            maxSurge: 1
            maxUnavailable: 0
        template: 
          metadata: 
            labels: 
              name: test-aaa1upload
              app: test-aaa1upload
              version: v1
          spec: 
            containers: 
              - name: test-aaa1upload
                image: xxx.xxx.xxx/aaa/aaa:v1.0
                command : ["./server"]
                args: ["-e", "test"]
                ports:
                - containerPort: 10011
                volumeMounts:
                 - name: aaaupload-rw
                   mountPath: /data/file_upload
                #resources:
                  #limits:
                    #cpu: 4000m
                    #memory: 1Gi
                  #requests:
                    #cpu: 600m
                    #memory: 500Mi
            volumes:
            - name: aaaupload-rw
              persistentVolumeClaim:
               claimName: aaaupload-rw
            nodeSelector:
              type: test-node111
      ---
      apiVersion: v1 
      kind: Service
      metadata: 
        name: test-aaa1upload
        namespace: nginx-aaa
      spec: 
        type: NodePort
        ports: 
          - name: http-test-aaa1upload 
            port: 10011
            protocol: TCP 
            nodePort: 30121
        selector: 
          name: test-aaa1upload

    • 0
    • 0
    • 0
    • 17
    • 请登录之后再进行评论

      登录
    • 单栏布局 侧栏位置: