@@ -676,6 +676,19 @@ function start_cloud_controller_manager {
676
676
export CLOUD_CTLRMGR_PID=$!
677
677
}
678
678
679
+ function wait_node_ready(){
680
+ # check the nodes information after kubelet daemon start
681
+ local nodes_stats=" ${KUBECTL} --kubeconfig '${CERT_DIR} /admin.kubeconfig' get nodes"
682
+ local node_name=$KUBELET_HOST
683
+ local system_node_wait_time=30
684
+ local interval_time=2
685
+ kube::util::wait_for_success " $system_node_wait_time " " $interval_time " " $nodes_stats | grep $node_name "
686
+ if [ $? == " 1" ]; then
687
+ echo " time out on waiting $node_name info"
688
+ exit 1
689
+ fi
690
+ }
691
+
679
692
function start_kubelet {
680
693
KUBELET_LOG=${LOG_DIR} /kubelet.log
681
694
mkdir -p " ${POD_MANIFEST_PATH} " & > /dev/null || sudo mkdir -p " ${POD_MANIFEST_PATH} "
@@ -790,6 +803,10 @@ function start_kubelet {
790
803
function start_kubeproxy {
791
804
PROXY_LOG=${LOG_DIR} /kube-proxy.log
792
805
806
+ # wait for kubelet collect node information
807
+ echo " wait kubelet ready"
808
+ wait_node_ready
809
+
793
810
cat << EOF > /tmp/kube-proxy.yaml
794
811
apiVersion: kubeproxy.config.k8s.io/v1alpha1
795
812
kind: KubeProxyConfiguration
@@ -1003,9 +1020,6 @@ if [[ "${START_MODE}" != "kubeletonly" ]]; then
1003
1020
if [[ " ${EXTERNAL_CLOUD_PROVIDER:- } " == " true" ]]; then
1004
1021
start_cloud_controller_manager
1005
1022
fi
1006
- if [[ " ${START_MODE} " != " nokubeproxy" ]]; then
1007
- start_kubeproxy
1008
- fi
1009
1023
start_kubescheduler
1010
1024
start_kubedns
1011
1025
if [[ " ${ENABLE_NODELOCAL_DNS:- } " == " true" ]]; then
@@ -1031,6 +1045,11 @@ if [[ "${START_MODE}" != "nokubelet" ]]; then
1031
1045
esac
1032
1046
fi
1033
1047
1048
+ if [[ " ${START_MODE} " != " kubeletonly" ]]; then
1049
+ if [[ " ${START_MODE} " != " nokubeproxy" ]]; then
1050
+ start_kubeproxy
1051
+ fi
1052
+ fi
1034
1053
if [[ -n " ${PSP_ADMISSION} " && " ${AUTHORIZATION_MODE} " = * RBAC* ]]; then
1035
1054
create_psp_policy
1036
1055
fi
0 commit comments