<p>When I try to create a persistentVolume on Okteto Cloud with the following definition:</p>

<pre><code>kind: PersistentVolume
apiVersion: v1
metadata:
  name: postgres-pv
  labels:
    type: local
    app: postgres
spec:
  storageClassName: manual
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: "/mnt/data"
</code></pre>

<p>I get the following error:</p>

<pre><code>Error from server (Forbidden): error when retrieving current configuration of:
Resource: "/v1, Resource=persistentvolumes", GroupVersionKind: "/v1, Kind=PersistentVolume"
Name: "postgres-pv", Namespace: ""
Object: &amp;{map["apiVersion":"v1" "kind":"PersistentVolume" "metadata":map["annotations":map["kubectl.kubernetes.io/last-applied-configuration":""] "labels":map["app":"postgres" "type":"local"] "name":"postgres-pv"] "spec":map["accessModes":["ReadWriteMany"] "capacity":map["storage":"5Gi"] "hostPath":map["path":"/mnt/data"]]]}
from server for: "deploy/k8s.postgres.yml": persistentvolumes "postgres-pv" is forbidden: User "system:serviceaccount:okteto:07e6fdbf-55c2-4642-81e3-051e8309000f" cannot get resource "persistentvolumes" in API group "" at the cluster scope
</code></pre>

<p>However according to <a href="https://okteto.com/docs/cloud/multitenancy.html" rel="nofollow noreferrer">the Okteto cloud docs</a>, persistentVolumes seem to be authorized.</p>

<p><strong>How would I create one on there ?</strong></p>

<p>.</p>

<p>For context I'm trying to reproduce a simple postgres deployment (no replication, no backups).
Here's my complete deployment file:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: postgres
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
        - name: postgres
          image: postgres:10.4
          imagePullPolicy: "IfNotPresent"
          ports:
            - containerPort: 5432
          envFrom:
            - configMapRef:
                name: postgres-config
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgredb
      volumes:
        - name: postgredb
          persistentVolumeClaim:
            claimName: postgres-pv-claim

---

apiVersion: v1
kind: Service
metadata:
  name: postgres
spec:
  type: ClusterIP  
  ports:
  - name: postgres
    port: 5432
  selector:
    app: postgres

---

apiVersion: v1
kind: ConfigMap
metadata:
  name: postgres-config
  labels:
    app: postgres
data:
  POSTGRES_DB: postgresdb
  POSTGRES_USER: postgresadmin
  POSTGRES_PASSWORD: admin123

---

kind: PersistentVolume
apiVersion: v1
metadata:
  name: postgres-pv
  labels:
    type: local
    app: postgres
spec:
  storageClassName: manual
  capacity:
    storage: 5Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: "/mnt/data"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: postgres-pv-claim
  labels:
    app: postgres
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 5Gi

</code></pre>

Nicolas Marshall
<p>Persistent volumes is a cluster-wide resource and it is not allowed.
The docs are wrong, thanks for pointing it out.</p>

<p>You can create instead PersistentVolumeClaims using the default storage class (and remove the persistent volume manifest):</p>

<pre><code>  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: postgres-pv-claim
  spec:
    accessModes:
    - ReadWriteOnce
    resources:
      requests:
        storage: 10Gi
</code></pre>

<p>Hope it helps :-)</p>
