I am trying to run indy-nodes in kubernetes. These indy nodes are sandbox nodes and write data in /var/lib/indy
directory inside the container. When I run the pod with a volume mounted, it does not write anything in the volume directory. Although it creates a directory inside the volume, it is empty all the time. However, when I create a pod without a volume mount option, the container writes data inside /var/lib/indy
.
Following is the Dockerfile:
Hastebin: https://hastebin.com/hitinefizi.nginx
Kubernetes Deployment:
{{- $root := .}}
{{- range .Values.indy}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
# namespace: {{$root.Values.namespace}}
name: {{.name}}
spec:
selector:
matchLabels:
name: {{.name}}
replicas: 1
strategy:
type: Recreate
template:
metadata:
labels:
name: {{.name}}
spec:
containers:
- name: {{.name}}
image: {{.image}}
volumeMounts:
- name: {{$root.Values.pv.metadata.name}}
mountPath: "/var/lib/indy/sandbox"
subPath: "volume/indy/{{.name}}/sandbox"
ports:
- containerPort: {{ index .ports 0 }}
- containerPort: {{ index .ports 1 }}
nodeSelector:
nodeType: {{$root.Values.hosts.blockchain}}
volumes:
- name: {{$root.Values.pv.metadata.name}}
{{- if eq $root.Values.storage.type "nfs" }}
persistentVolumeClaim:
claimName: {{$root.Values.pvc.metadata.name}}
{{- else }}
hostPath:
path: /var/kubeshare/
{{- end }}
{{- end}}
The directory inside volume:
[root@centos1 kubeshare]# tree volume/indy/
volume/indy/
|-- indy-node1
|-- indy-node2
|-- indy-node3
`-- indy-node
The directory /var/lib/indy
inside the container without volume:
root@indy-node1-587c4758bf-2hpp6:/var/lib/indy# tree -L 3
.
|-- plugins
`-- sandbox
|-- data
| `-- Node1
|-- domain_transactions_genesis
|-- keys
| |-- Node1
| |-- Node1C
| |-- Node2
| |-- Node3
| `-- Node4
|-- node1_additional_info.json
|-- node1_info.json
|-- node1_version_info.json
`-- pool_transactions_genesis
I am not sure why it is happening. Any help/suggestions would be appreciated.
Update: This is the same thing happening with docker-compose when I try to use local volume.