mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #31508 from wojtek-t/grab_etcd_logs_from_kubemark
Automatic merge from submit-queue Grab etcd logs from kubemark & retry etcd starts to avoid image pull errors Ref #31105 @gmarek
This commit is contained in:
commit
83fa5dff5d
@ -19,21 +19,33 @@
|
|||||||
EVENT_STORE_IP=$1
|
EVENT_STORE_IP=$1
|
||||||
EVENT_STORE_URL="http://${EVENT_STORE_IP}:4002"
|
EVENT_STORE_URL="http://${EVENT_STORE_IP}:4002"
|
||||||
NUM_NODES=$2
|
NUM_NODES=$2
|
||||||
|
|
||||||
|
retry() {
|
||||||
|
for i in {1..4}; do
|
||||||
|
"$@" && return 0 || sleep $i
|
||||||
|
done
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
if [ "${EVENT_STORE_IP}" == "127.0.0.1" ]; then
|
if [ "${EVENT_STORE_IP}" == "127.0.0.1" ]; then
|
||||||
sudo docker run --net=host -v /var/etcd/data-events:/var/etcd/data -d \
|
# Retry starting etcd to avoid pulling image errors.
|
||||||
gcr.io/google_containers/etcd:3.0.4 /usr/local/bin/etcd \
|
retry sudo docker run --net=host \
|
||||||
|
-v /var/etcd/data-events:/var/etcd/data -v /var/log:/var/log -d \
|
||||||
|
gcr.io/google_containers/etcd:3.0.4 /bin/sh -c "/usr/local/bin/etcd \
|
||||||
--listen-peer-urls http://127.0.0.1:2381 \
|
--listen-peer-urls http://127.0.0.1:2381 \
|
||||||
--advertise-client-urls=http://127.0.0.1:4002 \
|
--advertise-client-urls=http://127.0.0.1:4002 \
|
||||||
--listen-client-urls=http://0.0.0.0:4002 \
|
--listen-client-urls=http://0.0.0.0:4002 \
|
||||||
--data-dir=/var/etcd/data
|
--data-dir=/var/etcd/data 1>> /var/log/etcd-events.log 2>&1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo docker run --net=host -v /var/etcd/data:/var/etcd/data -d \
|
# Retry starting etcd to avoid pulling image errors.
|
||||||
gcr.io/google_containers/etcd:3.0.4 /usr/local/bin/etcd \
|
retry sudo docker run --net=host \
|
||||||
|
-v /var/etcd/data:/var/etcd/data -v /var/log:/var/log -d \
|
||||||
|
gcr.io/google_containers/etcd:3.0.4 /bin/sh -c "/usr/local/bin/etcd \
|
||||||
--listen-peer-urls http://127.0.0.1:2380 \
|
--listen-peer-urls http://127.0.0.1:2380 \
|
||||||
--advertise-client-urls=http://127.0.0.1:2379 \
|
--advertise-client-urls=http://127.0.0.1:2379 \
|
||||||
--listen-client-urls=http://0.0.0.0:2379 \
|
--listen-client-urls=http://0.0.0.0:2379 \
|
||||||
--data-dir=/var/etcd/data
|
--data-dir=/var/etcd/data 1>> /var/log/etcd.log 2>&1"
|
||||||
|
|
||||||
# Increase the allowed number of open file descriptors
|
# Increase the allowed number of open file descriptors
|
||||||
ulimit -n 65536
|
ulimit -n 65536
|
||||||
|
@ -115,38 +115,6 @@ run-gcloud-compute-with-retries firewall-rules create "${INSTANCE_PREFIX}-kubema
|
|||||||
--target-tags "${MASTER_TAG}" \
|
--target-tags "${MASTER_TAG}" \
|
||||||
--allow "tcp:443"
|
--allow "tcp:443"
|
||||||
|
|
||||||
if [ "${SEPARATE_EVENT_MACHINE:-false}" == "true" ]; then
|
|
||||||
EVENT_STORE_NAME="${INSTANCE_PREFIX}-event-store"
|
|
||||||
run-gcloud-compute-with-retries disks create "${EVENT_STORE_NAME}-pd" \
|
|
||||||
${GCLOUD_COMMON_ARGS} \
|
|
||||||
--type "${MASTER_DISK_TYPE}" \
|
|
||||||
--size "${MASTER_DISK_SIZE}"
|
|
||||||
|
|
||||||
run-gcloud-compute-with-retries instances create "${EVENT_STORE_NAME}" \
|
|
||||||
${GCLOUD_COMMON_ARGS} \
|
|
||||||
--machine-type "${MASTER_SIZE}" \
|
|
||||||
--image-project="${MASTER_IMAGE_PROJECT}" \
|
|
||||||
--image "${MASTER_IMAGE}" \
|
|
||||||
--tags "${EVENT_STORE_NAME}" \
|
|
||||||
--network "${NETWORK}" \
|
|
||||||
--scopes "storage-ro,compute-rw,logging-write" \
|
|
||||||
--disk "name=${EVENT_STORE_NAME}-pd,device-name=master-pd,mode=rw,boot=no,auto-delete=no"
|
|
||||||
|
|
||||||
EVENT_STORE_IP=$(gcloud compute instances describe ${EVENT_STORE_NAME} \
|
|
||||||
--zone="${ZONE}" --project="${PROJECT}" | grep networkIP: | cut -f2 -d":" | sed "s/ //g")
|
|
||||||
|
|
||||||
until gcloud compute ssh --zone="${ZONE}" --project="${PROJECT}" "${EVENT_STORE_NAME}" --command="ls" &> /dev/null; do
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
gcloud compute ssh "${EVENT_STORE_NAME}" --zone="${ZONE}" --project="${PROJECT}" \
|
|
||||||
--command="sudo docker run --net=host -d gcr.io/google_containers/etcd:3.0.4 /usr/local/bin/etcd \
|
|
||||||
--listen-peer-urls http://127.0.0.1:2380 \
|
|
||||||
--advertise-client-urls=http://127.0.0.1:4002 \
|
|
||||||
--listen-client-urls=http://0.0.0.0:4002 \
|
|
||||||
--data-dir=/var/etcd/data"
|
|
||||||
fi
|
|
||||||
|
|
||||||
ensure-temp-dir
|
ensure-temp-dir
|
||||||
gen-kube-bearertoken
|
gen-kube-bearertoken
|
||||||
create-certs ${MASTER_IP}
|
create-certs ${MASTER_IP}
|
||||||
|
Loading…
Reference in New Issue
Block a user