apiVersion: extensions/v1beta1 kind: Deployment metadata: name: nexus3 labels: app: nexus3 spec: template: metadata: labels: app: nexus3 spec: initContainers: - name: volume-mount-hack image: busybox command: ["sh", "-c", "chown -R 200:200 /nexus-data"] volumeMounts: - name: nexus-data mountPath: /nexus-data containers: - image: sonatype/nexus3 name: nexus3 ports: - containerPort: 8081 name: nexus3 volumeMounts: - name: nexus-data mountPath: /nexus-data volumes: - name: nexus-data hostPath: path: /vagrant/nexus-data --- apiVersion: v1 kind: Service metadata: name: nexus3 spec: type: NodePort ports: - port: 8081 nodePort: 30003 selector: app: nexus3