在开发机器中挂载 kubernetes 的卷



我有一个在Google Cloud Platform上运行的Kubernetes集群。我有 3 个节点和几个在这些节点上运行的 pod。

其中一个 pod 运行 Ghost 博客平台,并安装了gcePersistentDisk卷。用于创建 Pod 的manifest文件:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    name: ghost
  name: ghost
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: ghost
    spec:
      containers:
      - image: ghost:0.7
        name: ghost
        env:
        - name: NODE_ENV
          value: production
        ports:
        - containerPort: 2368
          name: http-server
        volumeMounts:
            - name: ghost
              mountPath: /var/lib/ghost
      volumes:
        - name: ghost
          gcePersistentDisk:
            pdName: ghost
            fsType: ext4

我想以某种方式从我的开发机器访问此卷。有没有办法在我的机器中安装这个磁盘?

如果您的开发计算机不是 GCE 集群(即 GCE 虚拟机)的一部分,那么您将无法直接挂载它。在这种情况下,最好的办法是通过挂载它的机器(即你的 Pod 计划到的节点)通过 SSH 连接到它。

最新更新