简体   繁体   中英

Kubernetes access Persistance volume mount externally

I have setup kubernetes Cluster and mounted volume mount as gcePersistentDisk in Google Cloud, It claims and mount successfully in Pods. But i want to access this volume externally so that i can write it through git/ssh or manual. As disk is Already used and mounted i cannot access it. How to write files through externally?

gcePersistentDisk is a network-based disk, and provisioned volumes can only be used by GCE instances in the same project and zone.

The fact is that this kind of resource supports readWriteOnce and ReadOnlyMany . You can use a GCE persistent storage to share data as read-only between multiple pods in the same zone.

Back to your question: you can write on this volume only from one pod . No other pods can use it as write storage - neither external nor from the same project.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: php
  labels:
    app: php
spec:
  replicas: 1
  selector:
    matchLabels:
      app: php
  template:
    metadata:
      labels:
        app: php
    spec:
      containers:
        - image: php:7.1-apache
          imagePullPolicy: Always
          name: php
          resources:
            requests:
              cpu: 200m
          ports:
            - containerPort: 80
              name: php
          volumeMounts:
            - name: php-persistent-storage
              mountPath: /var/www
      volumes:
        - name: php-persistent-storage
          gcePersistentDisk:
            pdName: php-phantomjs-disk
            fsType: ext4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM