Adding "allow-privileged true" flag kills the kubelet
See original GitHub issueI need to run some pods as privileged and I found (https://github.com/ubuntu/microk8s/issues/216) that I have to use --allow-privileged true
which I did and as suggested I restarted the required daemons but that killed my kubelet and microk8s. I even deleted everything and reinstalled microk8s but the same happened.
Please run microk8s.inspect
and attach the generated tarball to this issue.
microk8s.inspect
Inspecting services
Service snap.microk8s.daemon-containerd is running
Service snap.microk8s.daemon-apiserver is running
Service snap.microk8s.daemon-proxy is running
FAIL: Service snap.microk8s.daemon-kubelet is not running
For more details look at: sudo journalctl -u snap.microk8s.daemon-kubelet
Service snap.microk8s.daemon-scheduler is running
Service snap.microk8s.daemon-controller-manager is running
Service snap.microk8s.daemon-etcd is running
Copy service arguments to the final report tarball
Inspecting AppArmor configuration
Gathering system info
Copy network configuration to the final report tarball
Copy processes list to the final report tarball
Copy snap list to the final report tarball
Inspect kubernetes cluster
Building the report tarball
Report tarball is at /var/snap/microk8s/743/inspection-report-20190806_181638.tar.gz
And
sudo journalctl -u snap.microk8s.daemon-kubelet | tail
Aug 06 18:14:51 ali-P51 microk8s.daemon-kubelet[5306]: --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
Aug 06 18:14:51 ali-P51 microk8s.daemon-kubelet[5306]: --volume-plugin-dir string The full path of the directory in which to search for additional third party volume plugins (default "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/")
Aug 06 18:14:51 ali-P51 microk8s.daemon-kubelet[5306]: --volume-stats-agg-period duration Specifies interval for kubelet to calculate and cache the volume disk usage for all pods and volumes. To disable volume calculations, set to 0. (default 1m0s) (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)
Aug 06 18:14:51 ali-P51 microk8s.daemon-kubelet[5306]: F0806 18:14:51.854669 5306 server.go:156] unknown flag: --allow-privileged
Aug 06 18:14:52 ali-P51 systemd[1]: snap.microk8s.daemon-kubelet.service: Service hold-off time over, scheduling restart.
Aug 06 18:14:52 ali-P51 systemd[1]: snap.microk8s.daemon-kubelet.service: Scheduled restart job, restart counter is at 5.
Aug 06 18:14:52 ali-P51 systemd[1]: Stopped Service for snap application microk8s.daemon-kubelet.
Aug 06 18:14:52 ali-P51 systemd[1]: snap.microk8s.daemon-kubelet.service: Start request repeated too quickly.
Aug 06 18:14:52 ali-P51 systemd[1]: snap.microk8s.daemon-kubelet.service: Failed with result 'exit-code'.
Aug 06 18:14:52 ali-P51 systemd[1]: Failed to start Service for snap application microk8s.daemon-kubelet.
As we can see allow-priviliged is not defined for kubelet.
I also tried the --allow-privileged=true
instead of --allow-privileged true
but it kills my kubelet.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Adding "allow-privileged true" flag kills the kubelet #583
I need to run some pods as privileged and I found (#216) that I have to use --allow-privileged true which I did and...
Read more >How to use the --privileged flag with container engines
Executing container engines with the --privileged flag tells the engine to launch the container process without any further "security" lockdown.
Read more >Managing Security Context Constraints | Cluster Administration
Allows containers to run as any user. Prevents privileged containers. $ oc adm policy add-scc-to-group anyuid system:authenticated.
Read more >Privileged Docker containers—do you really need them?
Although setting this flag on processes running rootless doesn't actually give the process any more privileges than the user has it ...
Read more >Allow Privileged Containers in Kubernetes on Google ...
We are looking at ways to solve this (adding a flag when creating your cluster to allow privileged containers; making privileged containers ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If anyone else falls here while trying to enable privileged containers on microk8s, the way to do it is to add a PodSecurityPolicy to /var/snap/microk8s/current/args/kube-apiserver:
--enable-admission-plugins="NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota,PodSecurityPolicy"
And restart the service:
sudo systemctl restart snap.microk8s.daemon-apiserver.service
EDIT: After more investigation, from what I understand to allow privileged containers you need to add the following line to /var/snap/microk8s/current/args/kube-apiserver:
--allow-privileged
And then restart the microk8s api server daemon:
sudo systemctl restart snap.microk8s.daemon-apiserver
But then it’s also possible to use PodSecurityPolicy in combination with --allow-privileged if you want to allow privileged containers and restrict who is allowed to create them.
To do that, you add a PodSecurityPolicy to /var/snap/microk8s/current/args/kube-apiserver:
--enable-admission-plugins="PodSecurityPolicy"
And restart the service:
sudo systemctl restart snap.microk8s.daemon-apiserver
Update: After some investigation, I found out that this is a problem with elasticsearch and pv. I will close this issue.