## I have deleted all the Azure AKS Kubernetes Nodes, how to restore back the Cluster to it’s original state?

I am new to the Azure AKS Cluster world, and while messing with a test cluster i have deleted all its Nodes with `kubectl delete node xxxx`, thinking that the cluster will heal itself. Boy, was i wrong.

Now, let me explain the issue, so, when i run `kubectl get nodes`, i get `No resources found`.
In the “Node Pools” in the portal, i can see that there are 3 Nodes,
i have scaled the Pool up and down, but in kubectl shows no nodes – `No resources found`.
When i run `kubectl get pods`, all the pods are shown in pending state.

Extra Info:

• The AKS Cluster was created manually, no ARM template or script was saved.
• The AKS Cluster is using Availability Set (not Scale Set) for the Pool, so i can not add new
Pool, and move the Pods there.

My question(s) to you is:

1. How to get the Nodes to be shown in kubectl again? (The Pool has 3 Nodes there sitting)
2. Can i somehow restore the Cluster to be working again? Move the Pods somehow, somewhere?
3. What would you do in this case?

EDIT:

• after some time showing “No Resources found” when i ran “kubectl get nodes”, now 2 nodes came back online, but one is still missing. The Pool has count of 3. The 2 Nodes which are shown are in Ready State. But all the Pods are still in Pending state. No errors in Events.

New Question:

• Is there a way to start populating the 2 Ready Nodes with the Pending Pods?

Thanks again folks.

## I have deleted all the Azure AKS Kubernetes Nodes, how to restore back the Cluster to it’s original state?

I am new to the Azure AKS Cluster world, and while messing with a test cluster i have deleted all its Nodes with `kubectl delete node xxxx`, thinking that the cluster will heal itself. Boy, was i wrong.

Now, let me explain the issue, so, when i run `kubectl get nodes`, i get `No resources found`.
In the “Node Pools” in the portal, i can see that there are 3 Nodes,
i have scaled the Pool up and down, but in kubectl shows no nodes – `No resources found`.
When i run `kubectl get pods`, all the pods are shown in pending state.

Extra Info:

• The AKS Cluster was created manually, no ARM template or script was saved.
• The AKS Cluster is using Availability Set (not Scale Set) for the Pool, so i can not add new
Pool, and move the Pods there.

My question(s) to you is:

1. How to get the Nodes to be shown in kubectl again? (The Pool has 3 Nodes there sitting)
2. Can i somehow restore the Cluster to be working again? Move the Pods somehow, somewhere?
3. What would you do in this case?

EDIT:

• after some time showing “No Resources found” when i ran “kubectl get nodes”, now 2 nodes came back online, but one is still missing. The Pool has count of 3. The 2 Nodes which are shown are in Ready State. But all the Pods are still in Pending state. No errors in Events.

New Question:

• Is there a way to start populating the 2 Ready Nodes with the Pending Pods?

Thanks again folks.

## kubernetes – Kubecost frontend access issue on AKS

I have installed kubecost on Azure Kubernetes Service cluster using https://www.kubecost.com/install.html#show-instructions. When I enable port-forwarding, I can access the frontend using `curl http://localhost:9090/`. But its not accessible using `http://<machine-ip>:9090` in the browser (machine-ip is the public ip of the vm where I’m running the commands and I have opened inbound port 9090). So how do I get the UI in the browser?

I also Tried exposing `kubecost-cost-analyzer` service as LoadBalancer and tried accessing the UI using the external IP assigned, but can’t access in the browser or using curl. Need help in debugging this issue and getting the UI in browser.

``````NAME                                        TYPE           CLUSTER-IP     EXTERNAL-IP    PORT(S)                      AGE
service/kubecost-cost-analyzer              LoadBalancer   10.0.144.134   20.69.195.16         9001/TCP,9003/TCP,9090:30112/TCP   32m
``````

## azure – az aks create – it used to create Service Principal now Managed Service Identity

I’m following the proper instructions and the documentation must be out of date.

https://docs.microsoft.com/en-us/azure/aks/kubernetes-service-principal

Automatically create and use a service principal
When you create an AKS cluster in the Azure portal or using the az aks create command, Azure can automatically generate a service principal.
In the following Azure CLI example, a service principal is not specified. In this scenario, the Azure CLI creates a service principal for the AKS cluster. To successfully complete the operation, your Azure account must have the proper rights to create a service principal.

``````az aks create --name myAKSCluster --resource-group myResourceGroup
``````

This is what happened a few months ago – see Finished service principal creation:

Now when I try I get Add role propagation:

The problem is querying the servicePrincipalProfile.clientId results in msi, I need the guid of the service principal not the Managed Service Identity.

``````\$CLIENT_ID=\$(az aks show --resource-group \$AKS_RESOURCE_GROUP --name \$AKS_CLUSTER_NAME --query "servicePrincipalProfile.clientId" --output tsv)
echo \$CLIENT_ID
``````

Used to work:

Now its changed:

How do I create the Kubernetes Cluster with a Service Principal as the documentation states and how it used to work?

## aks – nginx ingress IP allowlist on Azure Kubernetes Services

I have a SOLR cluster set up with a Service of type LoadBalancer to expose port 8983. A requirement is SSL termination, so I have set up an nginx ingress controller with a route through to the back end service. All of this is working as expected, however I would now like to restrict access to only certain IPs.

When I tried to use the nginx.ingress.kubernetes.io/whitelist-source-range annotation, I noticed that the requests all come from the internal IP of the node, and not from the client as expected. Does this mean traffic needs to be filtered before it gets to the AKS cluster? If so, what is the best method of doing that, as it seems like modifying the automatically-created NSG is not recommended.

## kubernetes – Azure AKS does not have D2 v4 nodes listed in selection

Want to select D2 v4 (0GB Temp storage) nodes for my AKS node pool, but this node size is not available.

Now we are using D2s v3 (16GB temp storage).
That temp storage is not used and also is not that cheap (premium p10 ssd).

Azure Pricing calculators have this node size listed, so we had expectation it will be available.

Region: West Europe

Is there any way how to request that specific node size or where could we find information about why it is not available?

Or is this because for AKS there always has to be some sort of temp storage for kubernetes management?

## algorithms – While number can be checked for primality in O(n^0.5) then why was it considered to be not in P until AKS test?

The bit length of $$n$$ is $$log(n)$$, if we forget about the most significant digits, which is always $$1$$ except for $$n=0$$. As a function of $$t=log(n)$$ you have $$n^{1/2}=2^{t/2}$$. It is in terms of the bit length of $$n$$ that AKS runs in polynomial time, while the naive test doesn’t.

## Algorithms – how did the authors of the AKS paper reach the upper limit for r? and what does the multiplicative order have to do with anything?

I recently read the newspaper "PRIMES is in P", but unfortunately many steps were skipped, which led to confusion. My main problem is the upper limit of r, which was not explained at all in the work (I don't see the connection of these limits with the running time of the algorithm), for example how they came to the upper limit O (log ^ 5 n) for r, why is it exactly this number? why not O (log ^ 2 n) or something else. In addition, they had specified a condition for r in the second step of the algorithm. They wanted the order of r mod n to be greater than log ^ 2 n, but I don't understand why this has to do with the polynomial runtime or why it has to be greater than log ^ 2 n.

Can someone please explain why this is true? or how to derive these numbers?

## How can I expose the aks service cluster port to the internet?

I am a beginner with Kubernetes and Azure. I know that a service in my cluster is Exposés port like 32111, but it is not accessible over the Internet. What can I do to forward this service port to the internet?

## Azure AKS cluster migration

Problem:
We have a migration cluster from proof of concept to test / stagging
We searched in docs.microsoft.com and in external resources
https://stackoverflow.com/questions/51336864/azure-aks-change-location-region
about AKS service and migration and nothing found
Problem:
How should I migrate and AKS clusters from one region to another, such as from Western Europe to Northern Switzerland