Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Karpenter Schedule for Node Disruption #1264

Closed
tarunmittal24 opened this issue May 17, 2024 · 2 comments
Closed

Karpenter Schedule for Node Disruption #1264

tarunmittal24 opened this issue May 17, 2024 · 2 comments
Labels
needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@tarunmittal24
Copy link

tarunmittal24 commented May 17, 2024

Hi I am facing a issue in which the node got refreshed, one's the new ami is being released by the aws team, as i have not mentioned the ami-selector terms this is a expected behaviour, but as per security i need to update image every 30 days, that i have handled with the expireAfter: 720h in the nodepool config, But the case is, if i mentioned the ami-selector terms and put the specific image-ami-id, even after it got expired in the 30 days it will take the same image.

Any way to control this, like want the new nodes will comes after x days, with the new ami as that particular point of time and want that it should happened during the specific schedule like on weekends [Saturday (2-3 am)], not on weekdays.

My Current Config

Node-pool.yaml

apiVersion: karpenter.sh/v1beta1
kind: NodePool
metadata:
  name: core
spec:
  disruption:
    consolidateAfter: Never
    expireAfter: 720h
    consolidationPolicy: WhenEmpty
    budgets:
      - nodes: 10%
      - schedule: "0 0 * * mon-fri"
        duration: 24h
        nodes: "0"
  limits:
    cpu: "12"
    memory: 45Gi
  template:
    metadata:
      labels:
        node: core
    spec:
      taints:
        - key: "node"
          value: "core"
          effect: "NoSchedule"
      nodeClassRef:
        apiVersion: karpenter.k8s.aws/v1beta1
        kind: EC2NodeClass
        name: core
      kubelet: 
        maxPods: 110
      requirements:
      - key: node.kubernetes.io/instance-type
        operator: In
        values: 
          - m5a.large
          - m6a.large
          - m6i.large
          - m5.large
          - m4.large
      - key: kubernetes.io/os
        operator: In
        values:
        - linux
      - key: kubernetes.io/arch
        operator: In
        values:
        - amd64
      - key: karpenter.sh/capacity-type	
        operator: In	
        values:
          - on-demand

node-class.yaml

apiVersion: karpenter.k8s.aws/v1beta1
kind: EC2NodeClass
metadata:
 name: core
spec:
 amiFamily: AL2
 metadataOptions:
   httpEndpoint: enabled
   httpTokens: required
 subnetSelectorTerms:
   - tags:
       karpenter.sh/zfh-prod/team: "infra"
       aws-cdk:subnet-name: "EKSPrivate"
 securityGroupSelectorTerms:
   - id: "sg-009b2e138f9263f3d" 
 role: "PROD-EKS-KarpenterNode"  
 tags:
   Name: PROD-EKS/karpenter.sh/core
 metadataOptions:
   httpEndpoint: enabled
   httpProtocolIPv6: disabled
   httpPutResponseHopLimit: 2
   httpTokens: required
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label May 17, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If Karpenter contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@njtran
Copy link
Contributor

njtran commented May 20, 2024

What I think you want is Node Disruption Budgets, which was released in v0.34. https://karpenter.sh/docs/concepts/disruption/#disruption-budgets.

Going to close this, feel free to re-open if you think your feature request is different.

@njtran njtran closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
None yet
Development

No branches or pull requests

3 participants