Description of problem: A correctly configured kubernetes will mount a ca.crt and token data into pods at their path: /var/run/secrets/kubernetes.io/serviceaccount/ However SELinux on the node prevents access to the ca.crt and token files. Turning off SELinux (setenforce 0) allows access again. Version-Release number of selected component (if applicable): kubernetes-1.1.0-0.17.git388061f.fc23.x86_64 How reproducible: Every time.
Created attachment 1135317 [details] Script to setup kubernetes Kubernetes as packaged in Fedora requires a scripted setup before it is able to start pods appropriately. This file is part of reproducing this issue, it should be run before kubernetes services are started.
Created attachment 1135318 [details] A simple pod to reproduce the issue
Make sure SELinux is enforcing: # setenforce 1 First setup and start kubernetes: # wget -o kubernetes.setup https://bugzilla.redhat.com/attachment.cgi?id=1135317 # sh kubernetes.setup # systemctl start docker etcd kube-apiserver kube-controller-manager kube-scheduler kubelet kube-proxy Now deploy a pod to the new kubernetes cluster: # wget -o pod.json https://bugzilla.redhat.com/attachment.cgi?id=1135318 # kubectl create -f pod.json Wait for the pod to start: # kubectl get pods Now log into the pod and try to access the mounted secrets: # kubectl exec -ti tiny /bin/cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt Actual results: # kubectl exec -ti tiny /bin/cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt cat: can't open '/var/run/secrets/kubernetes.io/serviceaccount/ca.crt': Permission denied error: Error executing remote command: Error executing command in container: Error executing in Docker Container: 1 Expected results (which you can see if you setenforce 0): # kubectl exec -ti tiny /bin/cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt -----BEGIN CERTIFICATE----- MIIC/TCCAeWgAwIBAgIJAJBPiGTbKtEeMA0GCSqGSIb3DQEBCwUAMBUxEzARBgNV BAMMCmt1YmVybmV0ZXMwHhcNMTYwMzExMTc0MDQ0WhcNMjQwODA4MTc0MDQ0WjAV MRMwEQYDVQQDDAprdWJlcm5ldGVzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB CgKCAQEA20PGPb5EPdf76bFO5/jdbIER6wlQsuERqCi7B50KtoxM41JF1RcmRX1W ...
Paul, haven't we talked about this like 1bazillion times? We need to label /var/lib/kubelet/something differently?
Are these specific to each pod, or do they need to be shared between all pods?
> Are these specific to each pod, or do they need to be shared between all pods? The CA is shared between all pods. I believe the token file is specific to the pods serviceaccount configuration.
Then they should be mounted shared.
/var/lib/kubelet needs to be labeled with svirt_sandbox_file_t for mounts like this to work correctly. I notice this issue is still open from March -- is this still an issue?
This message is a reminder that Fedora 23 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 23. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '23'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 23 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.