Skip to content

Commit

Permalink
fix: kube-proxy check
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Feb 9, 2021
1 parent 49dfba9 commit 2dbcb76
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 16 deletions.
26 changes: 18 additions & 8 deletions dist/images/install-pre-1.16.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2087,14 +2087,6 @@ checkDaemonSet(){
fi
}
checkKubeProxy(){
healthResult=`kubectl get node -o wide | grep -v "INTERNAL-IP" | awk '{printf "curl -g -6 -sL -w %{http_code} http://[%s]:10256/healthz -o /dev/null | grep -v 200 \n", $6}' | bash` || true
if [ -n "$healthResult" ]; then
echo "kube-proxy's health check failed"
exit 1
fi
}
checkDeployment(){
name="$1"
ready=$(kubectl get deployment -n $KUBE_OVN_NS "$name" -o jsonpath={.status.readyReplicas})
Expand All @@ -2109,6 +2101,24 @@ checkDeployment(){
fi
}
checkKubeProxy(){
dsMode=`kubectl get ds -n kube-system | grep kube-proxy || true`
if [ -z "$dsMode" ]; then
nodeIps=`kubectl get node -o wide | grep -v "INTERNAL-IP" | awk '{print $6}'`
for node in $nodeIps
do
healthResult=`curl -g -6 -sL -w %{http_code} http://[$node]:10256/healthz -o /dev/null | grep -v 200 || true`
if [ -n "$healthResult" ]; then
echo "$node kube-proxy's health check failed"
exit 1
fi
done
else
checkDaemonSet kube-proxy
fi
echo "kube-proxy ready"
}
if [ $# -lt 1 ]; then
showHelp
exit 0
Expand Down
18 changes: 14 additions & 4 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2140,11 +2140,21 @@ checkDeployment(){
}
checkKubeProxy(){
healthResult=`kubectl get node -o wide | grep -v "INTERNAL-IP" | awk '{printf "curl -g -6 -sL -w %{http_code} http://[%s]:10256/healthz -o /dev/null | grep -v 200 \n", $6}' | bash` || true
if [ -n "$healthResult" ]; then
echo "kube-proxy's health check failed"
exit 1
dsMode=`kubectl get ds -n kube-system | grep kube-proxy || true`
if [ -z "$dsMode" ]; then
nodeIps=`kubectl get node -o wide | grep -v "INTERNAL-IP" | awk '{print $6}'`
for node in $nodeIps
do
healthResult=`curl -g -6 -sL -w %{http_code} http://[$node]:10256/healthz -o /dev/null | grep -v 200 || true`
if [ -n "$healthResult" ]; then
echo "$node kube-proxy's health check failed"
exit 1
fi
done
else
checkDaemonSet kube-proxy
fi
echo "kube-proxy ready"
}
if [ $# -lt 1 ]; then
Expand Down
19 changes: 15 additions & 4 deletions dist/images/kubectl-ko
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ xxctl(){
}

diagnose(){
kubectl get crd vpcs.kubeovn.io
kubectl get crd subnets.kubeovn.io
kubectl get crd ips.kubeovn.io
kubectl get svc kube-dns -n kube-system
Expand Down Expand Up @@ -268,11 +269,21 @@ checkDeployment(){
}

checkKubeProxy(){
healthResult=`kubectl get node -o wide | grep -v "INTERNAL-IP" | awk '{printf "curl -g -6 -sL -w %{http_code} http://[%s]:10256/healthz -o /dev/null | grep -v 200 \n", $6}' | bash` || true
if [ -n "$healthResult" ]; then
echo "kube-proxy's health check failed"
exit 1
dsMode=`kubectl get ds -n kube-system | grep kube-proxy || true`
if [ -z "$dsMode" ]; then
nodeIps=`kubectl get node -o wide | grep -v "INTERNAL-IP" | awk '{print $6}'`
for node in $nodeIps
do
healthResult=`curl -g -6 -sL -w %{http_code} http://[$node]:10256/healthz -o /dev/null | grep -v 200 || true`
if [ -n "$healthResult" ]; then
echo "$node kube-proxy's health check failed"
exit 1
fi
done
else
checkDaemonSet kube-proxy
fi
echo "kube-proxy ready"
}

if [ $# -lt 1 ]; then
Expand Down

0 comments on commit 2dbcb76

Please sign in to comment.