Open mr-miles opened 1 year ago
Interesting!! Unfortunately, we do not expect that running Connect in "rootless, read-only filesystem" mode will work today 😞 That is definitely a direction that we are heading though! Just lots of work to resolve before we get there.
However, it looks like you have definitely made some meaningful progress! Well done!
Are you using the release-candidate chart with the --devel
flag? This SA error message should be resolved by the RBAC that the RC candidate produces - I'm surprised to see it cropping up here if you are!
Thanks! I have done some more digging and even if I run it as a privileged container, it complains if I set the launcher namespace to anything other than the connect namespace.
With connect+launcher in the same namespace though, it appears to be working!
Deploying connect server to the namespace "rsc" via helm, this works:
launcher:
enabled: true
but this does not:
launcher:
enabled: true
namespace: rsc-job
The namespace appears to be set correctly in the config at /var/lib/rstudio-connect-launcher/Kubernetes:
server-user=rstudio-connect
scratch-path=/var/lib/rstudio-connect-launcher/Kubernetes
profile-config=/etc/rstudio-connect/launcher/launcher.kubernetes.profiles.conf
kubernetes-namespace=rsc-job
verify-ssl-certs=1
certificate-authority=<b64-cert>
use-templating=1
job-expiry-hours=0.25
In the second (non-working) case, I opened a shell in the container and tested that the RBAC for the pod was set up to enable listing service accounts:
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) curl https://172.20.0.1/api/v1/namespaces/rsc-job/serviceaccounts -H "Authorization: Bearer $TOKEN" --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
{
"kind": "ServiceAccountList",
"apiVersion": "v1",
"metadata": {
"resourceVersion": "21703890"
},
"items": [
{
"metadata": {
"name": "default",
"namespace": "rsc-job",
"uid": "2b6d7eb0-b9d8-4f93-947d-f10ccd2a8c0b",
"resourceVersion": "17399132",
"creationTimestamp": "2023-05-31T16:47:53Z"
}
}
]
Is it possible there's been a regression for the case where the jobs are launched in a different namespace?
Our kubernetes environment only permits non-root, read-only containers and I was experimenting to see if I could get connect with launcher to run successfully like this. It looks like I succeeded but the launcher is complaining about not finding the default service account in the job namespace (it definitely exists) - can you shed any light on what it needs? Is there some part of the setup that I am missing? I am very excited about getting the off-host execution working
Also, it would be great if the non-root setup could be incorporated into the helm chart! I had to bypass the prestart script (which tries to run update-ca-certificates and requires being root), but it could just read the root ca from the filesystem and set the KUBERNETES_CA_CERT_DATA environment variable. Even better, the cert is already on the file system so maybe it could be picked up from there rather than having to be specified.
The helm chart values file looks like this:
Console log runs through the config tasks fine and ends like this: