Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Add pod-pid-limit options to kubelet in kubernetes 1.10 (#2736)
Browse files Browse the repository at this point in the history
  • Loading branch information
youkoulayley authored and jackfrancis committed May 30, 2018
1 parent 9645794 commit 384a005
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/clusterdefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ Below is a list of kubelet options that acs-engine will configure by default:
|"--image-gc-low-threshold"|"850"|
|"--non-masquerade-cidr"|"10.0.0.0/8"|
|"--azure-container-registry-config"|"/etc/kubernetes/azure.json"|
|"--pod-max-pids"|"100" (need to activate the feature in --feature-gates=SupportPodPidsLimit=true)|
|"--feature-gates"|No default (can be a comma-separated list). On agent nodes `Accelerators=true` will be applied in the `--feature-gates` option for k8s versions before 1.11.0|

Below is a list of kubelet options that are *not* currently user-configurable, either because a higher order configuration vector is available that enforces kubelet configuration, or because a static configuration is required to build a functional cluster:
Expand Down
2 changes: 2 additions & 0 deletions pkg/acsengine/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ const (
DefaultJumpboxDiskSize = 30
// DefaultJumpboxUsername specifies the default admin username for the private cluster jumpbox
DefaultJumpboxUsername = "azureuser"
// DefaultKubeletPodMaxPIDs specifies the default max pid authorized by pods
DefaultKubeletPodMaxPIDs = 100
)

const (
Expand Down
8 changes: 8 additions & 0 deletions pkg/acsengine/defaults-kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func setKubeletConfig(cs *api.ContainerService) {
"--azure-container-registry-config": "/etc/kubernetes/azure.json",
"--event-qps": DefaultKubeletEventQPS,
"--cadvisor-port": DefaultKubeletCadvisorPort,
"--pod-max-pids": strconv.Itoa(DefaultKubeletPodMaxPIDs),
}

// If no user-configurable kubelet config values exists, use the defaults
Expand Down Expand Up @@ -82,6 +83,13 @@ func setKubeletConfig(cs *api.ContainerService) {
}
}

// Get rid of values not supported in v1.10 clusters
if !common.IsKubernetesVersionGe(o.OrchestratorVersion, "1.10.0") {
for _, key := range []string{"--pod-max-pids"} {
delete(o.KubernetesConfig.KubeletConfig, key)
}
}

// Remove secure kubelet flags, if configured
if !helpers.IsTrueBoolPointer(o.KubernetesConfig.EnableSecureKubelet) {
for _, key := range []string{"--anonymous-auth", "--client-ca-file"} {
Expand Down
2 changes: 2 additions & 0 deletions pkg/acsengine/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func TestSetMissingKubeletValues(t *testing.T) {
"--image-gc-low-threshold": "7",
"--non-masquerade-cidr": "8",
"--cloud-provider": "9",
"--pod-max-pids": "10",
}
setMissingKubeletValues(config, defaultKubeletConfig)
for key, val := range defaultKubeletConfig {
Expand All @@ -145,6 +146,7 @@ func TestSetMissingKubeletValues(t *testing.T) {
"--image-gc-low-threshold": "7",
"--non-masquerade-cidr": "8",
"--cloud-provider": "c",
"--pod-max-pids": "10",
}
setMissingKubeletValues(config, defaultKubeletConfig)
for key, val := range expectedResult {
Expand Down

0 comments on commit 384a005

Please sign in to comment.