Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Ability to change cgroupdriver to systemd #293

Open
MurzNN opened this issue Jun 18, 2021 · 3 comments
Open

[FEATURE] Ability to change cgroupdriver to systemd #293

MurzNN opened this issue Jun 18, 2021 · 3 comments

Comments

@MurzNN
Copy link

MurzNN commented Jun 18, 2021

Is your feature request related to a problem?

When we install kubernetes, it recommends the systemd driver for Docker:

[preflight] Running pre-flight checks
        [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/

So I try to set it via creating file:

cat > /etc/docker/daemon.json <<EOF
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}
EOF

But formula removes it on every state apply.
Other way is to change systemd docker service via setting

ExecStart=/usr/bin/dockerd --exec-opt native.cgroupdriver=systemd

Describe the solution you'd like

Will be good to have this setting in Docker formula.

Describe alternatives you've considered

Alternative is not deleting the /etc/docker/daemon.json file, but separate setting in formula will be much better.

@MurzNN
Copy link
Author

MurzNN commented Jun 19, 2021

Seems this can be implemented using docker.pkg.environ option, I'll try this and report results.

@danny-smit
Copy link
Collaborator

The latest version of the formula has support to add settings to the daemon.json. Is that what what you're looking for?

For example:

docker:
  pkg:
    docker:
      daemon_config: 
        exec-opts: 
          - native.cgroupdriver=systemd
        log-driver: json-file
        log-opts: 
          max-size: 100m
        storage-driver: overlay2

@B1ue-W01f
Copy link

Thanks, this appears to be the solution. Adding to pillar example may be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants