I use AKS to create our cluster with 3 worker node and their names are node-0, node-1, node-2. They are created by Azure VMSS.
When I deploy a pod-new through Helm, the scheduler always schedules pod-new to node-0 or node-2 even though those node with heavy workload.
Assume there is a pod-old on node-0 or node-2, It will result in pod-old be evicted but still doesn't re-scheduled to node-1. I need to explicit use nodeSelector to move it to node-1.
Below is my deployment.yaml. To gain better resource usage, I don't specify request and limit cause my pod needs higher cpu-burst to do initialize. After initialization, it only needs a little resource to serve request.
apiVersion: apps/v1
kind: Deployment
metadata:
name: aks-service
labels:
helm.sh/chart: service-0.1.0
app.kubernetes.io/name: service
app.kubernetes.io/instance: aks
app.kubernetes.io/version: "1.16.0"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
minReadySeconds: 10
selector:
matchLabels:
app.kubernetes.io/name: service
app.kubernetes.io/instance: aks
template:
metadata:
labels:
app.kubernetes.io/name: service
app.kubernetes.io/instance: aks
spec:
imagePullSecrets:
- name: custom
serviceAccountName: account-with-azure-cr
securityContext:
fsGroup: 2000
runAsGroup: 3000
runAsUser: 1000
containers:
- name: frontend
image: imageurl
imagePullPolicy: IfNotPresent
ports:
- name: port-frontend
containerPort: 3000
protocol: TCP
terminationGracePeriodSeconds: 30
volumes:
- name: varlog
hostPath:
path: /var/log
- name: varlibdockercontainers
hostPath:
path: /var/lib/docker/containers
- name: varlogpod
hostPath:
path: /var/log/pods