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

kubelet service doesn't start on a system with swap #50443

Closed
MasseGuillaume opened this issue Nov 16, 2018 · 5 comments
Closed

kubelet service doesn't start on a system with swap #50443

MasseGuillaume opened this issue Nov 16, 2018 · 5 comments

Comments

@MasseGuillaume
Copy link
Contributor

Steps to reproduce

  # machine with swapDevices

  # kubernetes default config
  services = {
    kubernetes = {
      roles = ["master" "node"];
    };
  };
 sudo journalctl -u kubelet.service | grep "failed to run"

Nov 15 20:10:05 nixos kubelet[1391]: F1115 20:10:05.994998    1391 server.go:262] failed to run Kubelet: Running with swap on is not supported, please disable swap! or set --fail-swap-on flag to false. /proc/swaps contained: [Filename                                Type                Size        Used        Priority /dev/sda2                               partition        8388604        0        -2]

More details: kubernetes/kubeadm#610

Workaround: Disable swap: sudo swapoff -a & Restart service: sudo systemctl restart kubelet.service

@c0bw3b
Copy link
Contributor

c0bw3b commented Nov 21, 2018

/cc @johanot @offlinehacker

@johanot
Copy link
Contributor

johanot commented Nov 21, 2018

@MasseGuillaume You can set services.kubernetes.kubelet.extraOpts = ["--fail-swap-on=false"]; to disable this kubelet behavior.

See: https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/

@MasseGuillaume
Copy link
Contributor Author

MasseGuillaume commented Nov 22, 2018

@johanot

you mean: services.kubernetes.kubelet.extraOpts = "--fail-swap-on=false";

(it's a string for some reason)

extraOpts = mkOption {
description = "Kubernetes scheduler extra command line options.";
default = "";
type = types.str;
};

I think ideally this should be in the default configuration if we detect a swap device. This way, it would work out of the box.

@johanot
Copy link
Contributor

johanot commented Nov 22, 2018

It's a string yes. Sorry.

However I don't agree that we should change the default behavior of components, unless there's a strong reason for doing so. If the Kubernetes maintainers recommend against running the kubelet on swap-enabled nodes, it's not up to us to nullify this.

@srhb
Copy link
Contributor

srhb commented Nov 22, 2018

Agreed, the point of the upstream setting is presumably to protect against users accidentally runny kubelets on swap-enabled machines by accident. Inverting the default would void this safety. Let's not do that unless we have very good reason. :)

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

No branches or pull requests

4 participants