Prevent kubeadm-aio being run as root.
Prevent duplicate docker mounts by disallowing root in kubeadm-aio. Change-Id: I3e743a0d82e03b9d2ffb3af685c27dd15415ab81 Closes-Bug: #1711744
This commit is contained in:
parent
ebf571fd45
commit
862960dac3
@ -15,6 +15,12 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
set -xe
|
set -xe
|
||||||
|
|
||||||
|
# Exit if run as root
|
||||||
|
if [[ $EUID -eq 0 ]]; then
|
||||||
|
echo "This script cannot be run as root" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Setup shared mounts for kubelet
|
# Setup shared mounts for kubelet
|
||||||
sudo mkdir -p /var/lib/kubelet
|
sudo mkdir -p /var/lib/kubelet
|
||||||
sudo mount --bind /var/lib/kubelet /var/lib/kubelet
|
sudo mount --bind /var/lib/kubelet /var/lib/kubelet
|
||||||
@ -38,6 +44,7 @@ sudo rm -rfv \
|
|||||||
|
|
||||||
: ${KUBE_CNI:="calico"}
|
: ${KUBE_CNI:="calico"}
|
||||||
: ${CNI_POD_CIDR:="192.168.0.0/16"}
|
: ${CNI_POD_CIDR:="192.168.0.0/16"}
|
||||||
|
|
||||||
# Launch Container
|
# Launch Container
|
||||||
sudo docker run \
|
sudo docker run \
|
||||||
-dt \
|
-dt \
|
||||||
@ -67,7 +74,7 @@ while true; do
|
|||||||
if [ -f ${HOME}/.kubeadm-aio/admin.conf ]; then
|
if [ -f ${HOME}/.kubeadm-aio/admin.conf ]; then
|
||||||
READY="True"
|
READY="True"
|
||||||
fi
|
fi
|
||||||
[ $READY == "True" ] && break || true
|
[ "$READY" == "True" ] && break || true
|
||||||
sleep 1
|
sleep 1
|
||||||
now=$(date +%s)
|
now=$(date +%s)
|
||||||
[ $now -gt $end ] && \
|
[ $now -gt $end ] && \
|
||||||
|
Loading…
Reference in New Issue
Block a user