是否可以将Google Cloud Persistent Disk附加到Kubernetes中的作业?

时间:2017-03-30 12:39:26

标签: kubernetes google-kubernetes-engine

我查了一下文件。我写了一份工作描述并部署了它,但磁盘没有显示在Kubernetes Dashboard中。

是否可以将Google Cloud Persistent Disk附加到Kubernetes中的作业?

更新:这是定义文件。磁盘site1-disk存在:

apiVersion: batch/v1
kind: Job
metadata:
  name: page-retriever
spec:
  template:
    metadata:
      name: page-retriever
    spec:
      containers:
      - name: page-retriever
        image: eu.gcr.io/crawler-162906/page-retriever:v1
      restartPolicy: OnFailure
      volumes:
          - name: page-retriver-first-persistent-storage
            gcePersistentDisk:
              # This disk must already exist.
              pdName: site1-disk
              fsType: ext4

1 个答案:

答案 0 :(得分:1)

你绝对可以。看起来您只是错过了容器def的volumeMounts部分:

apiVersion: batch/v1
kind: Job
metadata:
  name: page-retriever
spec:
  template:
    metadata:
      name: page-retriever
    spec:
      containers:
      - name: page-retriever
        image: eu.gcr.io/crawler-162906/page-retriever:v1
        volumeMounts:
        - name: page-retriver-first-persistent-storage
          mountPath: /path/to/where/the/disk/will/be/mounted/in/container

      restartPolicy: OnFailure

      volumes:
          - name: page-retriver-first-persistent-storage
            gcePersistentDisk:
              # This disk must already exist.
              pdName: site1-disk
              fsType: ext4

没有它,卷&page; page-retrier-first-persistent-storage'与容器'页面检索器'

没有任何关系