mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-03 10:17:46 +00:00
Merge pull request #82413 from zhlhahaha/kube-proxy-error
local-up-cluster kube-proxy terminated error
This commit is contained in:
@@ -676,6 +676,19 @@ function start_cloud_controller_manager {
|
||||
export CLOUD_CTLRMGR_PID=$!
|
||||
}
|
||||
|
||||
function wait_node_ready(){
|
||||
# check the nodes information after kubelet daemon start
|
||||
local nodes_stats="${KUBECTL} --kubeconfig '${CERT_DIR}/admin.kubeconfig' get nodes"
|
||||
local node_name=$KUBELET_HOST
|
||||
local system_node_wait_time=30
|
||||
local interval_time=2
|
||||
kube::util::wait_for_success "$system_node_wait_time" "$interval_time" "$nodes_stats | grep $node_name"
|
||||
if [ $? == "1" ]; then
|
||||
echo "time out on waiting $node_name info"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function start_kubelet {
|
||||
KUBELET_LOG=${LOG_DIR}/kubelet.log
|
||||
mkdir -p "${POD_MANIFEST_PATH}" &>/dev/null || sudo mkdir -p "${POD_MANIFEST_PATH}"
|
||||
@@ -790,6 +803,10 @@ function start_kubelet {
|
||||
function start_kubeproxy {
|
||||
PROXY_LOG=${LOG_DIR}/kube-proxy.log
|
||||
|
||||
# wait for kubelet collect node information
|
||||
echo "wait kubelet ready"
|
||||
wait_node_ready
|
||||
|
||||
cat <<EOF > /tmp/kube-proxy.yaml
|
||||
apiVersion: kubeproxy.config.k8s.io/v1alpha1
|
||||
kind: KubeProxyConfiguration
|
||||
@@ -1003,9 +1020,6 @@ if [[ "${START_MODE}" != "kubeletonly" ]]; then
|
||||
if [[ "${EXTERNAL_CLOUD_PROVIDER:-}" == "true" ]]; then
|
||||
start_cloud_controller_manager
|
||||
fi
|
||||
if [[ "${START_MODE}" != "nokubeproxy" ]]; then
|
||||
start_kubeproxy
|
||||
fi
|
||||
start_kubescheduler
|
||||
start_kubedns
|
||||
if [[ "${ENABLE_NODELOCAL_DNS:-}" == "true" ]]; then
|
||||
@@ -1031,6 +1045,11 @@ if [[ "${START_MODE}" != "nokubelet" ]]; then
|
||||
esac
|
||||
fi
|
||||
|
||||
if [[ "${START_MODE}" != "kubeletonly" ]]; then
|
||||
if [[ "${START_MODE}" != "nokubeproxy" ]]; then
|
||||
start_kubeproxy
|
||||
fi
|
||||
fi
|
||||
if [[ -n "${PSP_ADMISSION}" && "${AUTHORIZATION_MODE}" = *RBAC* ]]; then
|
||||
create_psp_policy
|
||||
fi
|
||||
|
Reference in New Issue
Block a user