Skip to content

Commit

Permalink
Unattended upgrades addon (#1291)
Browse files Browse the repository at this point in the history
* Unattended upgrades

For
* APT based
* YUM based
* Flatcar

Signed-off-by: Artiom Diomin <[email protected]>

* Label nodes with detected OS

Signed-off-by: Artiom Diomin <[email protected]>

* Review changes

Signed-off-by: Artiom Diomin <[email protected]>

* add amzn2

Signed-off-by: Artiom Diomin <[email protected]>

* Deploy kured to Amazon Linux 2 too

Signed-off-by: Artiom Diomin <[email protected]>
  • Loading branch information
kron4eg authored Mar 26, 2021
1 parent 9a4228c commit 3ca4d2e
Show file tree
Hide file tree
Showing 8 changed files with 794 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ linters-settings:
govet:
check-shadowing: true
goimports:
local-prefixes: github.com/kubermatic
local-prefixes: k8c.io/kubeone

issues:
exclude-rules:
Expand Down
41 changes: 41 additions & 0 deletions addons/unattended-upgrades/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Unattended Upgrades

This addon will automate upgrading system packages of the distro of your choice.

## Requirements

Since KubeOne 1.3+ we automatically label control-plane nodes with
`v1.kubeone.io/operating-system` and worker nodes with
`v1.machine-controller.kubermatic.io/operating-system` and use those labels as
nodeAffinity in this addon manifests.

## What's included

This addon provides bunch of DaemonSets and operators:

* **Debian/Ubuntu**
DaemonSet that will install `unattended-upgrades`
* **RHEL/CentOS/Amazon Linux 2**
DaemonSet that will install and configure `yum-cron`/`dnf-automatic`
* **Debian/Ubuntu/RHEL/CentOS/Amazon Linux 2**
[Kured](https://github.com/weaveworks/kured) (DaemonSet and operator) that
will orchestrate node rebootes in case when it's required (kernel upgrades)
* **Flatcar Linux**
[Flatcar Linux Update Operator](https://github.com/kinvolk/flatcar-linux-update-operator)

## Deployment instructions

Copy files from this directory to your configured addons directory.

In `kubeone.yaml` config:
```yaml
addons:
enable: true
path: "./addons"
```
## Information about permissions
Since daemonSets provided by this addon are making changes on the nodes
themselves they require elevated permissions like full root access to the host
machine.
57 changes: 57 additions & 0 deletions addons/unattended-upgrades/apt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: unattended-upgrades-install
namespace: kube-system
spec:
selector:
matchLabels:
name: unattended-upgrades-install
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
name: unattended-upgrades-install
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: v1.machine-controller.kubermatic.io/operating-system
operator: In
values:
- ubuntu
- matchExpressions:
- key: v1.kubeone.io/operating-system
operator: In
values:
- ubuntu
- debian
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
hostPID: true
containers:
- name: "unattended-upgrades-install"
image: "alpine:3.12.4"
securityContext:
privileged: true
command:
- /bin/sh
- -c
- |
set -xeuo pipefail
apk add --no-cache bash util-linux
nsenter -t 1 -m -u -i -n -p -- bash -c "${STARTUP_SCRIPT}"
sleep inf
env:
- name: STARTUP_SCRIPT
value: |
set -xeuo pipefail
export DEBIAN_FRONTEND=noninteractive
apt-get install -y --no-install-recommends \
apt-utils \
unattended-upgrades
Loading

0 comments on commit 3ca4d2e

Please sign in to comment.