É possível usar o PersistentVolume para montar todo o diretório "/" de um contêiner do Linux.
Estou tentando montá-lo, mas ele falha. Eu basicamente quero um contêiner, onde eu estaria fazendo, várias alterações througtout e quero que essas alterações persistam em travamentos do pod / restart
ubuntu@kops:/tmp$ cat pod.yaml
kind: Deployment
apiVersion: apps/v1beta2
metadata:
name: task-pod
spec:
replicas: 1
selector:
matchLabels:
app: testing
template:
metadata:
labels:
app: testing
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
volumeMounts:
- mountPath: "/"
name: task-pv
volumes:
- name: task-pv
persistentVolumeClaim:
claimName: task-pvc
Erro
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 40s default-scheduler Successfully assigned task-pod-5569b7b85f-8vkwh to ip-172-20-48-22.us-west-2.compute.internal
Normal SuccessfulMountVolume 39s kubelet, ip-172-20-48-22.us-west-2.compute.internal MountVolume.SetUp succeeded for volume "default-token-p4qnh"
Normal SuccessfulMountVolume 23s kubelet, ip-172-20-48-22.us-west-2.compute.internal MountVolume.SetUp succeeded for volume "pvc-c5d5e0d7-4c8a-11e8-8b60-065b35183c1c"
Normal Pulled 9s (x3 over 22s) kubelet, ip-172-20-48-22.us-west-2.compute.internal Container image "nginx:1.7.9" already present on machine
Warning Failed 9s (x3 over 22s) kubelet, ip-172-20-48-22.us-west-2.compute.internal Error: Error response from daemon: invalid bind mount spec "/var/lib/kubelet/pods/7f777534-4c8f-11e8-8b60-065b35183c1c/volumes/kubernetes.io~aws-ebs/pvc-c5d5e0d7-4c8a-11e8-8b60-065b35183c1c:/": invalid volume specification: '/var/lib/kubelet/pods/7f777534-4c8f-11e8-8b60-065b35183c1c/volumes/kubernetes.io~aws-ebs/pvc-c5d5e0d7-4c8a-11e8-8b60-065b35183c1c:/': invalid mount config for type "bind": invalid specification: destination can't be '/'
Warning FailedSync 9s (x3 over 22s) kubelet, ip-172-20-48-22.us-west-2.compute.internal Error syncing pod
Tags aws kubernetes