Skip to content

Instantly share code, notes, and snippets.

@avielb
Created December 2, 2020 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avielb/9e7e62df6c57e478af443d9a7135a263 to your computer and use it in GitHub Desktop.
Save avielb/9e7e62df6c57e478af443d9a7135a263 to your computer and use it in GitHub Desktop.
Daemonset to automatically remove AKS spot instances default taint
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: untaint
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: untanit
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: untaint
subjects:
- kind: ServiceAccount
name: untaint
namespace: default
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: untaint
namespace: default
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: untaint
namespace: default
spec:
selector:
matchLabels:
app: untaint
template:
metadata:
labels:
app: untaint
spec:
tolerations:
- key: kubernetes.azure.com/scalesetpriority
effect: NoSchedule
containers:
- image: wardsco/sleep
imagePullPolicy: IfNotPresent
name: sleep
dnsPolicy: ClusterFirst
initContainers:
- command: ["/bin/sh","-c"]
args: ["kubectl taint node -l kubernetes.azure.com/scalesetpriority=spot kubernetes.azure.com/scalesetpriority:NoSchedule- || echo 0"]
image: wardsco/kubectl:1.11
imagePullPolicy: IfNotPresent
name: untaint-node
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccountName: untaint
updateStrategy:
rollingUpdate:
maxUnavailable: 1
type: RollingUpdate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment