Difference between revisions of "Kind: Provisioner"

From wikieduonline
Jump to navigation Jump to search
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
  [[kind: Provisioner]]
+
  [[kind:]] Provisioner
  
[[kubectl get provisioner -o yaml]]
+
* <code>[[kubectl get provisioner -o yaml]]</code>
[[kubectl get provisioner]]
+
* <code>[[kubectl get provisioner]]</code>
 +
 
 +
 
 +
== Official Karpenter provisioner example ==
 +
 
 +
apiVersion: [[karpenter.sh/v1alpha5]]
 +
kind: Provisioner
 +
<pre>
 +
metadata:
 +
  name: default
 +
spec:
 +
  # References cloud provider-specific custom resource, see your cloud provider specific documentation
 +
  providerRef:
 +
    name: default
 +
 
 +
  # Provisioned nodes will have these taints
 +
  # Taints may prevent pods from scheduling if they are not tolerated by the pod.
 +
  taints:
 +
    - key: example.com/special-taint
 +
      effect: NoSchedule
 +
 
 +
  # Provisioned nodes will have these taints, but pods do not need to tolerate these taints to be provisioned by this
 +
  # provisioner. These taints are expected to be temporary and some other entity (e.g. a DaemonSet) is responsible for
 +
  # removing the taint after it has finished initializing the node.
 +
  startupTaints:
 +
    - key: example.com/another-taint
 +
      effect: NoSchedule
 +
 
 +
  # Labels are arbitrary key-values that are applied to all nodes
 +
  labels:
 +
    billing-team: my-team
 +
 
 +
  # Requirements that constrain the parameters of provisioned nodes.
 +
  # These requirements are combined with pod.spec.affinity.nodeAffinity rules.
 +
  # Operators { In, NotIn } are supported to enable including or excluding values
 +
  requirements:
 +
    - key: "karpenter.k8s.aws/instance-category"
 +
      operator: In
 +
      values: ["c", "m", "r"]
 +
    - key: "karpenter.k8s.aws/instance-cpu"
 +
      operator: In
 +
      values: ["4", "8", "16", "32"]
 +
    - key: "karpenter.k8s.aws/instance-hypervisor"
 +
      operator: In
 +
      values: ["nitro"]
 +
    - key: "topology.kubernetes.io/zone"
 +
      operator: In
 +
      values: ["us-west-2a", "us-west-2b"]
 +
    - key: "kubernetes.io/arch"
 +
      operator: In
 +
      values: ["arm64", "amd64"]
 +
    - key: "karpenter.sh/capacity-type" # If not included, the webhook for the AWS cloud provider will default to on-demand
 +
      operator: In
 +
      values: ["spot", "on-demand"]
 +
 
 +
  # Karpenter provides the ability to specify a few additional Kubelet args.
 +
  # These are all optional and provide support for additional customization and use cases.
 +
  kubeletConfiguration:
 +
    clusterDNS: ["10.0.1.100"]
 +
    containerRuntime: containerd
 +
    systemReserved:
 +
      cpu: 100m
 +
      memory: 100Mi
 +
      ephemeral-storage: 1Gi
 +
    kubeReserved:
 +
      cpu: 200m
 +
      memory: 100Mi
 +
      ephemeral-storage: 3Gi
 +
    evictionHard:
 +
      memory.available: 5%
 +
      nodefs.available: 10%
 +
      nodefs.inodesFree: 10%
 +
    evictionSoft:
 +
      memory.available: 500Mi
 +
      nodefs.available: 15%
 +
      nodefs.inodesFree: 15%
 +
    evictionSoftGracePeriod:
 +
      memory.available: 1m
 +
      nodefs.available: 1m30s
 +
      nodefs.inodesFree: 2m
 +
    evictionMaxPodGracePeriod: 3m
 +
    podsPerCore: 2
 +
    maxPods: 20
 +
 
 +
  # Resource limits constrain the total size of the cluster.
 +
  # Limits prevent Karpenter from creating new instances once the limit is exceeded.
 +
  limits:
 +
    resources:
 +
      cpu: "1000"
 +
      memory: 1000Gi
 +
 
 +
  # Enables consolidation which attempts to reduce cluster cost by both removing un-needed nodes and down-sizing those
 +
  # that can't be removed.  Mutually exclusive with the ttlSecondsAfterEmpty parameter.
 +
  consolidation:
 +
    enabled: true
 +
 
 +
  # If omitted, the feature is disabled and nodes will never expire.  If set to less time than it requires for a node
 +
  # to become ready, the node may expire before any pods successfully start.
 +
  ttlSecondsUntilExpired: 2592000 # 30 Days = 60 * 60 * 24 * 30 Seconds;
 +
 
 +
  # If omitted, the feature is disabled, nodes will never scale down due to low utilization
 +
  ttlSecondsAfterEmpty: 30
 +
 
 +
  # Priority given to the provisioner when the scheduler considers which provisioner
 +
  # to select. Higher weights indicate higher priority when comparing provisioners.
 +
  # Specifying no weight is equivalent to specifying a weight of 0.
 +
  weight: 10
 +
</pre>
  
 
== Related ==
 
== Related ==
 
* [[Kubernetes Persistent Volume Claim (PVC)]]
 
* [[Kubernetes Persistent Volume Claim (PVC)]]
* <code>[[karpenter.sh/capacity-type]]</code>
+
* <code>[[karpenter.sh/]]capacity-type: [ [[spot]] | [[on-demand]] ]</code>
 
* <code>[[Karpenter]]</code>
 
* <code>[[Karpenter]]</code>
[[apiVersion]]
+
* <code>[[apiVersion]]</code>
 
+
* <code>[[ttlSecondsUntilExpired]]</code>
[[values:]]
+
* <code>[[Provisioner API]]</code>
  [[on-demand]]
+
* <code>[[kind: AWSNodeTemplate]]</code>
  [[spot]]
 
 
 
[[ttlSecondsUntilExpired]]
 
[[Provisioner API]]
 
  
 
== See also ==
 
== See also ==
 +
* {{kind: Provisioner}}
 +
* {{kubectl provisioner}}
 +
* {{karpenter.sh}}
 +
* {{Kubernetes provisioner}}
 
* {{Karpenter}}
 
* {{Karpenter}}
  
 
[[Category:K8s]]
 
[[Category:K8s]]

Latest revision as of 13:51, 5 March 2024

kind: Provisioner


Official Karpenter provisioner example[edit]

apiVersion: karpenter.sh/v1alpha5
kind: Provisioner
metadata:
  name: default
spec:
  # References cloud provider-specific custom resource, see your cloud provider specific documentation
  providerRef:
    name: default

  # Provisioned nodes will have these taints
  # Taints may prevent pods from scheduling if they are not tolerated by the pod.
  taints:
    - key: example.com/special-taint
      effect: NoSchedule

  # Provisioned nodes will have these taints, but pods do not need to tolerate these taints to be provisioned by this
  # provisioner. These taints are expected to be temporary and some other entity (e.g. a DaemonSet) is responsible for
  # removing the taint after it has finished initializing the node.
  startupTaints:
    - key: example.com/another-taint
      effect: NoSchedule

  # Labels are arbitrary key-values that are applied to all nodes
  labels:
    billing-team: my-team

  # Requirements that constrain the parameters of provisioned nodes.
  # These requirements are combined with pod.spec.affinity.nodeAffinity rules.
  # Operators { In, NotIn } are supported to enable including or excluding values
  requirements:
    - key: "karpenter.k8s.aws/instance-category"
      operator: In
      values: ["c", "m", "r"]
    - key: "karpenter.k8s.aws/instance-cpu"
      operator: In
      values: ["4", "8", "16", "32"]
    - key: "karpenter.k8s.aws/instance-hypervisor"
      operator: In
      values: ["nitro"]
    - key: "topology.kubernetes.io/zone"
      operator: In
      values: ["us-west-2a", "us-west-2b"]
    - key: "kubernetes.io/arch"
      operator: In
      values: ["arm64", "amd64"]
    - key: "karpenter.sh/capacity-type" # If not included, the webhook for the AWS cloud provider will default to on-demand
      operator: In
      values: ["spot", "on-demand"]

  # Karpenter provides the ability to specify a few additional Kubelet args.
  # These are all optional and provide support for additional customization and use cases.
  kubeletConfiguration:
    clusterDNS: ["10.0.1.100"]
    containerRuntime: containerd
    systemReserved:
      cpu: 100m
      memory: 100Mi
      ephemeral-storage: 1Gi
    kubeReserved:
      cpu: 200m
      memory: 100Mi
      ephemeral-storage: 3Gi
    evictionHard:
      memory.available: 5%
      nodefs.available: 10%
      nodefs.inodesFree: 10%
    evictionSoft:
      memory.available: 500Mi
      nodefs.available: 15%
      nodefs.inodesFree: 15%
    evictionSoftGracePeriod:
      memory.available: 1m
      nodefs.available: 1m30s
      nodefs.inodesFree: 2m
    evictionMaxPodGracePeriod: 3m
    podsPerCore: 2
    maxPods: 20

  # Resource limits constrain the total size of the cluster.
  # Limits prevent Karpenter from creating new instances once the limit is exceeded.
  limits:
    resources:
      cpu: "1000"
      memory: 1000Gi

  # Enables consolidation which attempts to reduce cluster cost by both removing un-needed nodes and down-sizing those
  # that can't be removed.  Mutually exclusive with the ttlSecondsAfterEmpty parameter.
  consolidation:
    enabled: true

  # If omitted, the feature is disabled and nodes will never expire.  If set to less time than it requires for a node
  # to become ready, the node may expire before any pods successfully start.
  ttlSecondsUntilExpired: 2592000 # 30 Days = 60 * 60 * 24 * 30 Seconds;

  # If omitted, the feature is disabled, nodes will never scale down due to low utilization
  ttlSecondsAfterEmpty: 30

  # Priority given to the provisioner when the scheduler considers which provisioner
  # to select. Higher weights indicate higher priority when comparing provisioners.
  # Specifying no weight is equivalent to specifying a weight of 0.
  weight: 10

Related[edit]

See also[edit]

Advertising: