Setting custom script extension in virtual machine scale set is changing the status of instances to NotReady.
I have set custom script extension using az command az vmss extension set --publisher Microsoft.Azure.Extensions --version 2.0 --name CustomScript --resource-group resource_group_name --vmss-name vmss_name --settings @./customConfig.json
customConfig.json
{
"fileUris": ["publiclinkoffile"],
"commandToExecute": "./filename"
}
Extension is set successfully and I can log into the instance and task by extension is done as expected. But unable to create any pod since the instance status is NotReady.
It can be viewed by executing command: $kubectl get nodes
By further debugging I got to know that kubelet and kubectl services are inactive(dead).I suspect this is because internally while checking health the expected path should be /usr/local/bin/kubectl But it is unable to find kubectl in /usr/local/bin path . The reason for this is after executing custom script extension many versions of kubelet and kubectl are being created .
How can avoid creating multiple versions of kubelet and kubectl so that My instance will be healthy?
NOTE: I am able to see the status of instance as Running in the Azure portal. I am able to view scaled instances only in the Azure portal but not by the command (kubectl get nodes).
Unable to figure it out! Can anyone help me