Create persistent volumes for minikube

Running the import works in minikube!
This commit is contained in:
Robert Schäfer 2019-01-30 19:18:23 +01:00
parent ad55cc03e5
commit 8a74f452a9
9 changed files with 106 additions and 0 deletions

View File

@ -46,6 +46,7 @@ kubectl apply -f secrets.yaml
## Deploy the app
```shell
cd ./staging
kubectl apply -f ./volumes
kubectl apply -f neo4j-deployment.yaml -f backend-deployment.yaml -f web-deployment.yaml -f db-migration-worker-deployment.yaml
```
This can take a while.
@ -68,3 +69,20 @@ kubectl expose deployment nitro-web --namespace=staging --type=LoadBalancer
minikube service nitro-backend --namespace=staging
minikube service nitro-web --namespace=staging
```
## Provisioning db-migration-worker
Copy your private ssh key and the `.known-hosts` file of your remote legacy server.
```shell
# check the corresponding db-migration-worker pod
kubectl --namespace=staging get pods
# change <POD_ID> below
kubectl cp path/to/your/ssh/keys/folder staging/nitro-db-migration-worker-<POD_ID>:/root/
```
Run the migration:
```shell
# change <POD_ID> below
kubectl --namespace=staging exec -it nitro-db-migration-worker-<POD_ID> ./import.sh
```

View File

@ -58,6 +58,18 @@ spec:
name: nitro-db-migration-worker
resources: {}
imagePullPolicy: Always
volumeMounts:
- mountPath: /root/
name: ssh-keys-directory
- mountPath: /mongo-export/
name: mongo-export
restartPolicy: Always
volumes:
- name: ssh-keys-directory
persistentVolumeClaim:
claimName: ssh-keys-claim
- name: mongo-export
persistentVolumeClaim:
claimName: mongo-export-claim
terminationGracePeriodSeconds: 30
status: {}

View File

@ -46,5 +46,12 @@ spec:
# - containerPort: 7473
resources: {}
imagePullPolicy: IfNotPresent
volumeMounts:
- mountPath: /mongo-export/
name: mongo-export
restartPolicy: Always
volumes:
- name: mongo-export
persistentVolumeClaim:
claimName: mongo-export-claim
status: {}

View File

@ -0,0 +1,11 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: mongo-export-claim
namespace: staging
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: mongo-export-volume
namespace: staging
spec:
accessModes:
- ReadWriteMany
capacity:
storage: 1Gi
hostPath:
path: /data/shared/mongo-exports/

View File

@ -0,0 +1,11 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: ssh-keys-claim
namespace: staging
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Mi

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: ssh-keys-volume
namespace: staging
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 1Mi
hostPath:
path: /data/pv0001/

View File

@ -0,0 +1,11 @@
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: uploads-claim
namespace: staging
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 8Gi

View File

@ -0,0 +1,12 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: uploads-volume
namespace: staging
spec:
accessModes:
- ReadWriteMany
capacity:
storage: 8Gi
hostPath:
path: /data/shared/uploads/