Search
Join the Technical Preview Program
See how NVMe-oF removes iSCSI
bottlenecks in your HCI
The Best Hyperconverged
Infrastructure
(HCI) for Enterprise
ROBO, SMB & Edge
The Best Virtual SAN
for Enterprise ROBO, SMB & Edge

Prioritize your high critical applications in AKS

  • April 27, 2021
  • 4 min read
Cloud and Virtualization Architect and Microsoft MVP. Florent specializes in public, private, and hybrid cloud ecosystems. An MCSE in Private Cloud, he provides technical leadership in Cloud and Datacenter Management. Florent delivers high-authority insights on Azure deployments, virtualization strategy, and optimizing enterprise-scale cloud infrastructure.
Cloud and Virtualization Architect and Microsoft MVP. Florent specializes in public, private, and hybrid cloud ecosystems. An MCSE in Private Cloud, he provides technical leadership in Cloud and Datacenter Management. Florent delivers high-authority insights on Azure deployments, virtualization strategy, and optimizing enterprise-scale cloud infrastructure.


When you deploy your AKS cluster, by default, all pods have the same priority, 0, except for default pods that are created during the AKS creation:

kubectl get pods --all-namespaces -o custom-columns=NAME:.metadata.name,PRIORITY:.spec.priorityClassName

Priority, 0, except for default pods

It means that when you do your CA rotation, or you have a crash, pods will restart randomly 😊 first arrive, first serve…

With Pod Priority, you can classify your pods, to give a start priority.

By default, you have 2 class created:

2 class created

Bigger is the value, higher will be the priority.

Let’s start by adding 3 new priorities. Use the following yaml file to create them:

apiVersion: scheduling.k8s.io/v1beta1

kind: PriorityClass

metadata:

  name: dev-priority

value: 10000

globalDefault: false

---

apiVersion: scheduling.k8s.io/v1beta1

kind: PriorityClass

metadata:

  name: acc-priority

value: 100000

globalDefault: false

---

apiVersion: scheduling.k8s.io/v1beta1

kind: PriorityClass

metadata:

  name: prd-priority

value: 1000000

globalDefault: false

Apply this yaml file. We have now 3 new priorities, that we can use:

Apply yaml file

Now, let’s apply these priorities to pods:

kind: Deployment

apiVersion: apps/v1

metadata:

  name: nginx-dev

  labels:

    app: nginx-dev

    nginx-dev: nginx-dev

spec:

  replicas: 10

  selector:

    matchLabels:

      app: nginx-dev

      task: nginx-dev

  template:

    metadata:

      labels:

        app: nginx-dev

        task: nginx-dev

        version: v0.0.1

    spec:

      containers:

      - name: nginx-dev

        image: nginx

        ports:

        - containerPort: 80

      priorityClassName: dev-priority

Dev-priority

As you can see, I deployed a lot of pods, with priority, by using in my deployment file the priorityClassName parameter.

Because I can have a maximum of 30 pods per node, I scale down my cluster from 2 nodes to one. I can see that dev pods and pods without priority are not running:

Pods without priority are not running

If I check logs of pods, I can see

Check the logs of pods

As you can see, it works fine. Don’t forget to apply this great feature in your AKS environment.

You can also test this feature, by following this article: Kubernetes Operations: Prioritize Workload in Overcommitted Clusters (microsoft.com)

Hey! Found Florent’s insights useful? Looking for a cost-effective, high-performance, and easy-to-use hyperconverged platform?
Taras Shved
Taras Shved StarWind HCI Appliance Product Manager
Look no further! StarWind HCI Appliance (HCA) is a plug-and-play solution that combines compute, storage, networking, and virtualization software into a single easy-to-use hyperconverged platform. It's designed to significantly trim your IT costs and save valuable time. Interested in learning more? Book your StarWind HCA demo now to see it in action!