TestProject Forum

GKE k8s agent persistency

I’m trying to add persistency to k8s’ agent like this:

# usual agent setup above
...
          volumeMounts:
            - name: agent-storage
              mountPath: /var/testproject/agent
      volumes:
        - name: agent-storage
          persistentVolumeClaim:
            claimName: tp-agent-pvc
---
#***************************************
#TESTPROJECT VOLUME
#***************************************
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: tp-agent-pvc
  namespace: testproject
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi

However the agent fails to start with the error:

Data folder '/var/testproject/agent' is not writable

What am I doing wrong?