Created
December 2, 2020 07:09
-
-
Save avielb/9e7e62df6c57e478af443d9a7135a263 to your computer and use it in GitHub Desktop.
Daemonset to automatically remove AKS spot instances default taint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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