Automatically Taint and Label the node during starting of AKS cluster

Shreyas Arani 231 Reputation points
2021-09-30T03:57:02.777+00:00

Hi we have a 4 node AKS cluster, we are daily starting and stopping the AKS cluster as we are having budget constraint. we are using taint and tolerations to deploy specific pods on the tainted node. Also we are labelling the node. Our requirement is to automatically taint and label any one node out of the 4 nodes. So that we needn't to manually taint and label the node after the cluster has started. Can anyone help on how this can be achieved?

Azure Kubernetes Service
Azure Kubernetes Service

An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Shreyas Arani 231 Reputation points
    2021-09-30T07:06:35.687+00:00

    Hi @SRIJIT-BOSE-MSFT thank you for your quick response will try to implement the above scripts and will let you know about the results.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Shreyas Arani 231 Reputation points
    2021-09-30T13:17:47.457+00:00

    Hi @SRIJIT-BOSE-MSFT I can see that node has been labelled and tainted
    136640-image.png

    136666-image.png

    but the problem is that pod is in CrashloopBackOff state.
    136659-image.png

    Following is my deployment yaml file
    136725-image.png
    `

    And deployed the yaml using the command
    kubectl apply -f taint.yaml -n node-taint

    I checked the logs but couldn't infer anything from it.
    In my dockerfile I have used centos7 as the base image and my AKS cluster is ubuntu do you think this is causing the problem?

    Any other reason why it is in crashloopbackoff state?

    Was this answer helpful?


  4. Shreyas Arani 231 Reputation points
    2021-09-30T11:05:53.847+00:00

    Hi @SRIJIT-BOSE-MSFT can you similarly provide the command for labelling the node that needs to be added in the script. Even labelling should happen on the runtime and it should label the last node[same as the tainted node]. Because taint and tolerations doesn't guarantee that the pod matching the toleration will be scheduled on the node. To schedule the pod on tainted we need to use node affinity. So for this purpose we also need to label node during the starting of the cluster. please can you provide the command?

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.