Cosmo
Cosmo

Reputation: 541

Openshift deployment-config template fails to deploy pod if a volume is declared

I have an OpenShift deployment configuration template that I generated from a working deployment (using "oc export"). The original pod has a persistent volume claim (PVC) mounted on /data. When I try to deploy using the template, the pod never starts up. If I remove all mention of the volume and volume mount from the template, the pod does start. I then have to manually attach the volume. I want to be able to do it all from the template though. Here is the partial template showing only relevant items:

apiVersion: v1
kind: Template
metadata:
  name: myapp
objects:
- apiVersion: v1
  kind: DeploymentConfig
  metadata:
    name: myapp-service
  spec:
    template:
      spec:
        containers:
        - name: myapp-service
          image: my-private-registry/myapp-service:latest
          volumeMounts:
          - mountPath: /data
            name: volume-001
        volumes:
        - persistentVolumeClaim:
            claimName: nfs-pvc
          name: volume-001

When deployed with this template, the deployment sits waiting for the pod to be created ("Status: Container creating"). If the persistentVolumeClaim item is replaced with an ephemeral volume declaration:

        volumes:
        - emptyDir: {}
          name: volume-001

it starts up fine. So it seems that the problem is specific to the persistentVolumeClaim entry. Both the PV and PVC were set up beforehand, as shown here:

> oc get pv
NAME         CAPACITY   ACCESSMODES   STATUS    CLAIM                 REASON    AGE
nfs-pv00     50Gi       RWX           Bound     my-project/nfs-pvc              1h

> oc get pvc
NAME         STATUS    VOLUME     CAPACITY   ACCESSMODES   AGE
nfs-pvc      Bound     nfs-pv00   50Gi       RWX           1h

EDIT: Another data point (that perhaps I should have started with) is that if an existing deployment configuration is modified from the openshift console (Applications->Deployments->my-dc) by selecting "Attach storage" and specifying the PVC, the same behavior is observed as with the templated deployment: a new deployment launches (due to config change) but its associated pod never starts.

Upvotes: 1

Views: 2266

Answers (1)

Cosmo
Cosmo

Reputation: 541

SOLVED: My bad. I discovered that I had a bad mount point on the NFS server that I had set up to serve the PV. Once I specified the correct mount point, the pods started up fine (well, on to the next problem anyway).

Upvotes: 1

Related Questions