mirror of https://github.com/k3s-io/k3s
In gci mounter script, expose /var/lib/kubelet only and add more debugging logs.
Added a retry for rkt gc just to be safe. Signed-off-by: Vishnu Kannan <vishnuk@google.com>pull/6/head
parent
1ecc12f724
commit
e5c61922f8
|
@ -23,14 +23,25 @@ MOUNTER_USER=root
|
||||||
RKT_BINARY=/home/kubernetes/bin/rkt
|
RKT_BINARY=/home/kubernetes/bin/rkt
|
||||||
|
|
||||||
function gc {
|
function gc {
|
||||||
${RKT_BINARY} gc --grace-period=0s &> /dev/null
|
# Attempt to garbage collect rkt pods with 5 retries.
|
||||||
|
# Rkt pods end up creating new copies of mounts on the host. Hence it is ideal to clean them up right away.
|
||||||
|
attempt=0
|
||||||
|
until [ $attempt -ge 5 ]; do
|
||||||
|
${RKT_BINARY} gc --grace-period=0s && break
|
||||||
|
attempt=$[$attempt+1]
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Garbage collect old rkt containers on exit
|
# Garbage collect old rkt containers on exit
|
||||||
trap gc EXIT
|
trap gc EXIT
|
||||||
|
|
||||||
|
echo "Running mount using a rkt fly container"
|
||||||
|
|
||||||
${RKT_BINARY} run --stage1-name="coreos.com/rkt/stage1-fly:1.18.0" \
|
${RKT_BINARY} run --stage1-name="coreos.com/rkt/stage1-fly:1.18.0" \
|
||||||
--insecure-options=image \
|
--insecure-options=image \
|
||||||
--volume=rootfs,kind=host,source=/,readOnly=false,recursive=true \
|
--volume=kubelet,kind=host,source=/var/lib/kubelet,readOnly=false,recursive=true \
|
||||||
--mount volume=rootfs,target=/media/root \
|
--mount volume=kubelet,target=/var/lib/kubelet \
|
||||||
docker://${MOUNTER_DOCKER_IMAGE}:${MOUNTER_DOCKER_VERSION} --user=${MOUNTER_USER} --exec /bin/mount -- "$@"
|
docker://${MOUNTER_DOCKER_IMAGE}:${MOUNTER_DOCKER_VERSION} --user=${MOUNTER_USER} --exec /bin/mount -- "$@"
|
||||||
|
|
||||||
|
echo "Successfully ran mount using a rkt fly container"
|
Loading…
Reference in New Issue