-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathvm.sh
18 lines (16 loc) · 807 Bytes
/
vm.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
az vm extension set \
--resource-group rg-arc-vmnext \
--vm-name arc-vmnext \
--name customScript \
--publisher Microsoft.Azure.Extensions \
--force-update \
--protected-settings "{\"commandToExecute\": \" \
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml && \
notReadyNotes=\$(kubectl get nodes | grep NotReady | awk '{print \$1}' 2>/dev/null) && \
len=\${#notReadyNotes} && \
echo \"\"not ready\$len\"\" && \
if [[ -z \$notReadyNotes ]]; then echo \"\"xxxx\"\" && kubectl delete node \"\"\$notReadyNotes\"\"; fi && \
kubectl config use-context default && \
kubectl get pods -A -v6 \
\"}"