• k8s 在WSL2中以 hostPath 挂载本地卷


    wsl2 中的映射

    配置 yaml

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      annotations: {}
      labels:
        app: demo
      name: demo
      namespace: default
      resourceVersion: '315836'
    spec:
      progressDeadlineSeconds: 600
      replicas: 1
      revisionHistoryLimit: 10
      selector:
        matchLabels:
          app: demo
      strategy:
        rollingUpdate:
          maxSurge: 25%
          maxUnavailable: 25%
        type: RollingUpdate
      template:
        metadata:
          creationTimestamp: null
          labels:
            app: demo
        spec:
          containers:
            - image: httpd
              imagePullPolicy: Always
              name: httpd
              ports:
                - containerPort: 80
                  protocol: TCP
              resources: {}
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
              volumeMounts:
                - mountPath: /app
                  name: v1
                - mountPath: '/remote_debugger:rw'
                  name: v2
          dnsPolicy: ClusterFirst
          restartPolicy: Always
          schedulerName: default-scheduler
          securityContext: {}
          terminationGracePeriodSeconds: 30
          volumes:
            - hostPath:
                path: /run/desktop/mnt/host/d/microservices/dapr.eshop/services/accountservice/host/bin/debug/net6.0
                type: ''
              name: v1
            - hostPath:
                path: /run/desktop/mnt/host/c/users/administrator/vsdbg/vs2017u5
                type: ''
              name: v2

    进入pod 容器查看:

     已经挂载成功。注意对应目录:

    Windows WSL2 K8S-docker.io/hostpath
    C:// /mnt/c
    /run/desktop/mnt/host/c
    D:// /mnt/d
    /run/desktop/mnt/host/d

    文件浏览器:

  • 相关阅读:
    C# DictionaryHelper
    C# Autofac 的 BeanFactory
    正则替换
    java页面表格导出为Excel实现
    CentOS 7 下安装Nginx
    认识Java 虚拟机的架构
    06 查看网卡实时流量
    05 找出占用CPU、内存过高的进程
    04 一键查看服务器资源利用率
    03 批量创建100个用户并设置随机密码
  • 原文地址:https://www.cnblogs.com/mschen/p/16049876.html
Copyright © 2020-2023  润新知