Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Small Config enhancements #53

Merged
merged 3 commits into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions pkg/system/system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,18 @@ After=docker.service
Requires=docker.service

[Service]
ExecStartPre=/sbin/iptables -P FORWARD ACCEPT
ExecStart=/usr/bin/kubelet \
--allow-privileged=true \
--cloud-provider=aws \
--config /etc/kubernetes/kubelet/config.yaml \
--config=/etc/kubernetes/kubelet/config.yaml \
--network-plugin=cni \
--kubeconfig=/var/lib/kubelet/kubeconfig $KUBELET_CONTAINER_RUNTIME_ARGS $KUBELET_ARGS $KUBELET_NODE_LABELS $KUBELET_NODE_TAINTS $KUBELET_EXTRA_ARGS

Restart=always
StartLimitInterval=0
Restart=on-failure
RestartForceExitStatus=SIGPIPE
RestartSec=5
KillMode=process

[Install]
WantedBy=multi-user.target
Expand Down Expand Up @@ -117,11 +119,14 @@ authorization:
cacheAuthorizedTTL: 5m0s
cacheUnauthorizedTTL: 30s
clusterDomain: cluster.local
hairpinMode: hairpin-veth
clusterDNS: [172.20.0.10]
cgroupDriver: cgroupfs
cgroupRoot: /
featureGates:
RotateKubeletServerCertificate: true
serverTLSBootstrap: true
serializeImagePulls: false
kubeReserved:
cpu: 70m
memory: 1024Mi
Expand Down Expand Up @@ -256,24 +261,26 @@ After=containerd.service
Requires=containerd.service

[Service]
ExecStartPre=/sbin/iptables -P FORWARD ACCEPT
ExecStart=/usr/bin/kubelet \
--allow-privileged=true \
--cloud-provider=aws \
--config /etc/kubernetes/kubelet/config.yaml \
--config=/etc/kubernetes/kubelet/config.yaml \
--network-plugin=cni \
--kubeconfig=/var/lib/kubelet/kubeconfig $KUBELET_CONTAINER_RUNTIME_ARGS $KUBELET_ARGS $KUBELET_NODE_LABELS $KUBELET_NODE_TAINTS $KUBELET_EXTRA_ARGS

Restart=always
StartLimitInterval=0
Restart=on-failure
RestartForceExitStatus=SIGPIPE
RestartSec=5
KillMode=process

[Install]
WantedBy=multi-user.target
`
fs.Check(t, "/etc/systemd/system/kubelet.service", expected, 0640)

expected = `[Service]
Environment="KUBELET_CONTAINER_RUNTIME_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock --cgroup-driver=systemd"
Environment="KUBELET_CONTAINER_RUNTIME_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
`
fs.Check(t, "/etc/systemd/system/kubelet.service.d/40-container-runtime.conf", expected, 0640)
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/system/templates/etc/kubernetes/kubelet/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ authorization:
cacheAuthorizedTTL: 5m0s
cacheUnauthorizedTTL: 30s
clusterDomain: cluster.local
hairpinMode: hairpin-veth
clusterDNS: [{{.Node.ClusterDNS}}]
cgroupDriver: cgroupfs
cgroupRoot: /
featureGates:
RotateKubeletServerCertificate: true
serverTLSBootstrap: true
serializeImagePulls: false
{{- if and .Node.ReservedCPU .Node.ReservedMemory }}
kubeReserved:
cpu: {{.Node.ReservedCPU}}
Expand Down
8 changes: 5 additions & 3 deletions pkg/system/templates/etc/systemd/system/kubelet.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ After={{.Node.ContainerRuntime}}.service
Requires={{.Node.ContainerRuntime}}.service

[Service]
ExecStartPre=/sbin/iptables -P FORWARD ACCEPT
ExecStart=/usr/bin/kubelet \
--allow-privileged=true \
--cloud-provider=aws \
--config /etc/kubernetes/kubelet/config.yaml \
--config=/etc/kubernetes/kubelet/config.yaml \
--network-plugin=cni \
--kubeconfig=/var/lib/kubelet/kubeconfig $KUBELET_CONTAINER_RUNTIME_ARGS $KUBELET_ARGS $KUBELET_NODE_LABELS $KUBELET_NODE_TAINTS $KUBELET_EXTRA_ARGS

Restart=always
StartLimitInterval=0
Restart=on-failure
RestartForceExitStatus=SIGPIPE
RestartSec=5
KillMode=process

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Service]
{{- if eq .Node.ContainerRuntime "containerd" }}
Environment="KUBELET_CONTAINER_RUNTIME_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock --cgroup-driver=systemd"
Environment="KUBELET_CONTAINER_RUNTIME_ARGS=--container-runtime=remote --runtime-request-timeout=15m --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
{{ else if eq .Node.ContainerRuntime "docker" }}
Environment="KUBELET_CONTAINER_RUNTIME_ARGS=--container-runtime=docker"
{{ end -}}