Skip to content

Commit

Permalink
Merge pull request #47356 from dashpole/master_critical_pods
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue (batch tested with PRs 47669, 40284, 47356, 47458, 47701)

Mark Static pods on the Master as critical

fixes #47277.

A known issue with static pods is that they do not interact well with evictions.  If a static pod is evicted or oom killed, then it will never be recreated.  To mitigate this, we do not evict static pods that are critical.  In addition, non-critical pods are candidates for preemption if a critical pod is scheduled to the node.  If there are not enough allocatable resources on the node, this causes the static pod to be preempted.

This PR marks all static pods in the kube-system namspace as critical.

cc @vishh @dchen1107
  • Loading branch information
Kubernetes Submit Queue committed Jun 19, 2017
2 parents a73bf4e + e223eb9 commit 1e76d9e
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Pod
metadata:
name: etcd-empty-dir-cleanup
namespace: kube-system
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
labels:
k8s-app: etcd-empty-dir-cleanup
spec:
Expand Down
5 changes: 4 additions & 1 deletion cluster/saltbase/salt/etcd/etcd.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
"kind": "Pod",
"metadata": {
"name":"etcd-server{{ suffix }}",
"namespace": "kube-system"
"namespace": "kube-system",
"annotations": {
"scheduler.alpha.kubernetes.io/critical-pod": ""
}
},
"spec":{
"hostNetwork": true,
Expand Down
2 changes: 2 additions & 0 deletions cluster/saltbase/salt/kube-addons/kube-addon-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Pod
metadata:
name: kube-addon-manager
namespace: kube-system
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
labels:
component: kube-addon-manager
spec:
Expand Down
3 changes: 3 additions & 0 deletions cluster/saltbase/salt/kube-apiserver/kube-apiserver.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@
"metadata": {
"name":"kube-apiserver",
"namespace": "kube-system",
"annotations": {
"scheduler.alpha.kubernetes.io/critical-pod": ""
},
"labels": {
"tier": "control-plane",
"component": "kube-apiserver"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@
"metadata": {
"name":"kube-controller-manager",
"namespace": "kube-system",
"annotations": {
"scheduler.alpha.kubernetes.io/critical-pod": ""
},
"labels": {
"tier": "control-plane",
"component": "kube-controller-manager"
Expand Down
3 changes: 3 additions & 0 deletions cluster/saltbase/salt/kube-scheduler/kube-scheduler.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
"metadata": {
"name":"kube-scheduler",
"namespace": "kube-system",
"annotations": {
"scheduler.alpha.kubernetes.io/critical-pod": ""
},
"labels": {
"tier": "control-plane",
"component": "kube-scheduler"
Expand Down
2 changes: 2 additions & 0 deletions cluster/saltbase/salt/l7-gcp/glbc.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Pod
metadata:
name: l7-lb-controller-v0.9.5
namespace: kube-system
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
labels:
k8s-app: glbc
version: v0.9.5
Expand Down
2 changes: 2 additions & 0 deletions cluster/saltbase/salt/rescheduler/rescheduler.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: Pod
metadata:
name: rescheduler-v0.3.0
namespace: kube-system
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
labels:
k8s-app: rescheduler
version: v0.3.0
Expand Down
1 change: 1 addition & 0 deletions cmd/kubeadm/app/master/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ go_library(
"//pkg/bootstrap/api:go_default_library",
"//pkg/kubeapiserver/authorizer/modes:go_default_library",
"//pkg/kubectl/cmd/util:go_default_library",
"//pkg/kubelet/types:go_default_library",
"//pkg/util/version:go_default_library",
"//vendor/github.com/ghodss/yaml:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
Expand Down
8 changes: 5 additions & 3 deletions cmd/kubeadm/app/master/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
bootstrapapi "k8s.io/kubernetes/pkg/bootstrap/api"
authzmodes "k8s.io/kubernetes/pkg/kubeapiserver/authorizer/modes"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/pkg/util/version"
)

Expand Down Expand Up @@ -301,9 +302,10 @@ func componentPod(container api.Container, volumes ...api.Volume) api.Pod {
Kind: "Pod",
},
ObjectMeta: metav1.ObjectMeta{
Name: container.Name,
Namespace: "kube-system",
Labels: map[string]string{"component": container.Name, "tier": "control-plane"},
Name: container.Name,
Namespace: "kube-system",
Annotations: map[string]string{kubetypes.CriticalPodAnnotationKey: ""},
Labels: map[string]string{"component": container.Name, "tier": "control-plane"},
},
Spec: api.PodSpec{
Containers: []api.Container{container},
Expand Down

0 comments on commit 1e76d9e

Please sign in to comment.