1.Add taint label to node
kubectl taint nodes lp-knode-01 key=value:NoSchedule
kubectl taint nodes lp-knode-01 key=arm:NoSchedule
kubectl taint nodes lp-knode-01 node=arm64:NoSchedule
kubectl taint nodes lp-arm-{1,2,3,4}.home node=arm64:NoSchedule
kubectl get nodes -o json | jq '.items[].spec.taints'
2.Add toleration in deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: sonarqube-deployment
labels:
app: sonarqube
env: prod
spec:
replicas: 1
selector:
matchLabels:
app: sonarqube
env: prod
template:
metadata:
labels:
app: sonarqube
env: prod
spec:
nodeSelector:
node: "lp-knode-01"
containers:
- name: sonarqube-container
image: sonarqube
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "1024Mi"
cpu: "100m"
limits:
memory: "2048Mi"
cpu: "2000m"
volumeMounts:
- name: sonarqube-data
mountPath: /opt/sonarqube/data
ports:
- containerPort: 9000
tolerations:
- key: "key"
operator: "Equal"
value: "arm"
effect: "NoSchedule"
volumes:
- name: sonarqube-data
nfs:
server: 192.168.0.184
path: "/opt/nfs1/sonarqube/data"
---
kind: Service
apiVersion: v1
metadata:
name: sonarqube-service
labels:
app: sonarqube
env: prod
spec:
selector:
app: sonarqube
env: prod
ports:
- name: sonarqube
protocol: TCP
port: 9000
targetPort: 9000
nodePort: 30900
type: NodePort
tolerations:
- key: "key"
operator: "Exists"
effect: "NoSchedule"