puppetlabs / puppetlabs-kubernetes

This module install and configures a Kubernetes cluster
Apache License 2.0
92 stars 132 forks source link

Module does not enable the kubelet service #207

Closed nickperry closed 5 years ago

nickperry commented 5 years ago

Is this a BUG REPORT? YES

What you expected to happen?

I would expect the module to enable the kubelet systemd service.

What happened?

Neither kubeadm, nor the puppet module enable the service.

How to reproduce it?

Build a cluster using the module. Reboot. Kubelet does not automatically start. systemctl status kubelet shows the service is disabled. systemctl enable kubelet fixes the problem.

Anything else we need to know?

Kubeadm itself only starts the kubelet - it does not enable it. Therefore at reboot, the kubelet does not start again.

Versions:

puppetlabs-kubernetes 3.0.1 and master @ 3711d9f0ed2b2910df52e7aa4ec5b4b7535cb839

$ puppet --version 4.7.0 $ kubectl version v1.11.3 $ docker version OR crictl version 17.03.0-ce $ facter os { architecture => "x86_64", distro => { codename => "n/a", description => "Oracle Linux Server release 7.5", id => "OracleServer", release => { full => "7.5", major => "7", minor => "5" }, specification => ":core-4.1-amd64:core-4.1-noarch" }, family => "RedHat", hardware => "x86_64", name => "OracleLinux", release => { full => "7.5", major => "7", minor => "5" }, selinux => { enabled => false } }

nickperry commented 5 years ago

On my Puppet master, I tried hacking in

service { 'kubelet':
  enable => true
}

in the module's services.pp and it worked as expected. I just wondered is there a reason this hasn't been implemented already? I can't imagine a scenario where I wouldn't want the module to enable the kubelet service.

scotty-c commented 5 years ago

@nickperry if the cluster is configured correctly the system file is enabled by kubeadm

nickperry commented 5 years ago

Can you point me at the code in kubeadm that does that @scotty-c ?

From what I have read in the kubeadm code, it starts kubelet (but does not enable it)... https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/phases/kubelet/kubelet.go#L38-L44

kubeadm simply informs the user to enable the kubelet service themselves... /Exec[kubeadm init]/returns: #011[WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service' See https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/preflight/checks.go#L143-L146 https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/preflight/checks.go#L1027

davejrt commented 5 years ago

It looks like this warning is RHEL specific. I just tested on xenial and didn't get it

nickperry commented 5 years ago

Given then vendor preset for the kubelet service in the RPM package is disabled, I think having a Service resource for kubelet in the module, with ensure => enabled is reasonable.

davejrt commented 5 years ago

Yep all good, that comment was observational more than laying blame anywhere. Feel free to submit a PR or we’ll look at it this week