Technical note
K8S常用配置
亲和性
https://tachingchen.com/tw/blog/kubernetes-assigning-pod-to-nodes/
kubectl get nodes --show-labels
kubectl label nodes worker-s001 dubhe/role=middleware
deploy.yaml:
spec:
template:
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 1
preference:
matchExpressions:
- key: dubhe/role
operator: In
values:
- middleware
coredns自定义解析
# 编辑configmap
kubectl -n kube-system edit configmap coredns
# 添加自定义解析
hosts /etc/coredns/NodeHosts {
10.193.36.252 harbor.dubhe
10.193.36.33 gogs.dubhe
ttl 60
reload 15s
fallthrough
}
# 重启coredns的deployment