tl;dr:
I would like to know how to fix this error:
Error creating: pods "hook-image-awaiter-" is forbidden: unable to validate against any security context constraint: [
provider "anyuid": Forbidden: not usable by user or serviceaccount,
spec.containers[0].securityContext.runAsUser: Invalid value: 65534: must be in the ranges: [1000690000, 1000699999],
detailed version:
I would like to run a JupyterHub using OKD.
I do not grasp yet how (and what) to configure. I’ll post you what I did and what errors I received.
oc login --token=<my OKD API token> --server=<server-address:port>
Logged into "<server-address:port>" as "kube:admin" using the token provided.
You have access to 73 projects, the list has been suppressed. You can list all projects with 'oc projects'
oc new-project turing
Now using project "turing" on server "<server-address:port>".
You can add applications to this project with the 'new-app' command. For example, try:
oc new-app rails-postgresql-example
to build a new example application in Ruby. Or use kubectl to deploy a simple Kubernetes application:
kubectl create deployment hello-node --image=k8s.gcr.io/e2e-test-images/agnhost:2.33 -- /agnhost serve- hostname
Now, following the Zero to JupyterHub guide I create an empty config.yaml
Following the next step I run:
helm repo add jupyterhub-discourse https://jupyterhub.github.io/helm-chart/
"jupyterhub-discourse" has been added to your repositories
helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "jupyterhub-discourse" chart repository
Update Complete. ⎈Happy Helming!⎈
My helm upgrade
settings explained:
- “version1”: helm release number as in the docu
- “jupyterhub/jupyterhub”: the jupyterhub image
- “turing”: the namespace I created earlier
- “1.2.0”: the current JupyterHub helm chart release
- “config.yaml”: the empty file I created
helm upgrade --install version1 jupyterhub/jupyterhub --namespace turing --create-namespace --version=1.2.0 --values config.yaml --debug
history.go:56: [debug] getting history for release version1
Release "version1" does not exist. Installing it now.
install.go:178: [debug] Original chart version: "1.2.0"
install.go:195: [debug] CHART PATH: C:\Users\MUUQ04~1\AppData\Local\Temp\helm\repository\jupyterhub-1.2.0.tgz
client.go:128: [debug] creating 1 resource(s)
client.go:299: [debug] Starting delete for "hook-image-puller" DaemonSet
client.go:128: [debug] creating 1 resource(s)
client.go:299: [debug] Starting delete for "hook-image-awaiter" ServiceAccount
client.go:128: [debug] creating 1 resource(s)
client.go:299: [debug] Starting delete for "hook-image-awaiter" Role
client.go:128: [debug] creating 1 resource(s)
client.go:299: [debug] Starting delete for "hook-image-awaiter" RoleBinding
client.go:128: [debug] creating 1 resource(s)
client.go:299: [debug] Starting delete for "hook-image-awaiter" Job
client.go:128: [debug] creating 1 resource(s)
client.go:529: [debug] Watching for changes to Job hook-image-awaiter with timeout of 5m0s
client.go:557: [debug] Add/Modify event for hook-image-awaiter: ADDED
client.go:596: [debug] hook-image-awaiter: Jobs active: 0, jobs failed: 0, jobs succeeded: 0
Error: failed pre-install: timed out waiting for the condition
helm.go:84: [debug] failed pre-install: timed out waiting for the condition
This is the same error as the error in this topic.
But when I run:
kubectl get events --sort-by='{.lastTimestamp}'
I get the following securityContext error:
LAST SEEN TYPE REASON OBJECT MESSAGE
6m1s Warning FailedCreate daemonset/hook-image-puller
Error creating: pods "hook-image-puller-" is forbidden: unable to validate against any security context constraint: [
provider "anyuid": Forbidden: not usable by user or serviceaccount,
spec.initContainers[0].securityContext.runAsUser: Invalid value: 65534: must be in the ranges: [1000690000, 1000699999],
spec.initContainers[1].securityContext.runAsUser: Invalid value: 65534: must be in the ranges: [1000690000, 1000699999],
spec.containers[0].securityContext.runAsUser: Invalid value: 65534: must be in the ranges: [1000690000, 1000699999],
provider "nonroot": Forbidden: not usable by user or serviceaccount,
provider "hostmount-anyuid": Forbidden: not usable by user or serviceaccount,
provider "machine-api-termination-handler": Forbidden: not usable by user or serviceaccount,
provider "hostnetwork": Forbidden: not usable by user or serviceaccount,
provider "hostaccess": Forbidden: not usable by user or serviceaccount,
provider "node-exporter": Forbidden: not usable by user or serviceaccount,
provider "privileged": Forbidden: not usable by user or serviceaccount]
18s Warning FailedCreate job/hook-image-awaiter
Error creating: pods "hook-image-awaiter-" is forbidden: unable to validate against any security context constraint: [
provider "anyuid": Forbidden: not usable by user or serviceaccount,
spec.containers[0].securityContext.runAsUser: Invalid value: 65534: must be in the ranges: [1000690000, 1000699999],
provider "nonroot": Forbidden: not usable by user or serviceaccount,
provider "hostmount-anyuid": Forbidden: not usable by user or serviceaccount,
provider "machine-api-termination-handler": Forbidden: not usable by user or serviceaccount,
provider "hostnetwork": Forbidden: not usable by user or serviceaccount,
provider "hostaccess": Forbidden: not usable by user or serviceaccount,
provider "node-exporter": Forbidden: not usable by user or serviceaccount,
provider "privileged": Forbidden: not usable by user or serviceaccount]
According to the OpenShift Docu my user is “nfsnobody”.
How and where can I configure a correct user?
What did not work:
1. Setting uid + fsGid the same way as the old discussion:
Trying to run it like in the other discussion leads to:
PS C:\Users\<user>\Documents\CDI\jupyter> helm upgrade --install version2 jupyterhub/jupyterhub --namespace turing --create-namespace --version=1.2.0 --values config.yaml
Error: UPGRADE FAILED: execution error at (jupyterhub/templates/NOTES.txt:154:4):
#################################################################################
###### BREAKING: The config values passed contained no longer accepted #####
###### options. See the messages below for more details. #####
###### #####
###### To verify your updated config is accepted, you can use #####
###### the `helm template` command. #####
#################################################################################
RENAMED: hub.uid must as of 1.0.0 be configured using hub.containerSecurityContext.runAsUser
config.yaml:
proxy:
secretToken: “sha256~incrediblesecretsecret”
hub:
uid: 0
fsGid: 0
trying to fix that error (1.0.0):
config.yaml changed to:
proxy:
secretToken: “sha256~incrediblesecretsecret”
hub:
containerSecurityContext:
runAsUser: 1000
running it again returns:
PS C:\Users\<user>\Documents\CDI\jupyter> helm upgrade --install version2 jupyterhub/jupyterhub --namespace turing --create-namespace --version=1.2.0 --values config.yaml --debug
history.go:56: [debug] getting history for release version2
upgrade.go:142: [debug] preparing upgrade for version2
upgrade.go:150: [debug] performing update for version2
upgrade.go:322: [debug] creating upgraded release for version2
client.go:299: [debug] Starting delete for "hook-image-puller" DaemonSet
client.go:328: [debug] daemonsets.apps "hook-image-puller" not found
client.go:128: [debug] creating 1 resource(s)
client.go:299: [debug] Starting delete for "hook-image-awaiter" ServiceAccount
client.go:128: [debug] creating 1 resource(s)
client.go:299: [debug] Starting delete for "hook-image-awaiter" Role
client.go:128: [debug] creating 1 resource(s)
client.go:299: [debug] Starting delete for "hook-image-awaiter" RoleBinding
client.go:128: [debug] creating 1 resource(s)
client.go:299: [debug] Starting delete for "hook-image-awaiter" Job
client.go:328: [debug] jobs.batch "hook-image-awaiter" not found
client.go:128: [debug] creating 1 resource(s)
client.go:529: [debug] Watching for changes to Job hook-image-awaiter with timeout of 5m0s
client.go:557: [debug] Add/Modify event for hook-image-awaiter: ADDED
client.go:596: [debug] hook-image-awaiter: Jobs active: 0, jobs failed: 0, jobs succeeded: 0
upgrade.go:431: [debug] warning: Upgrade "version2" failed: pre-upgrade hooks failed: timed out waiting for the condition
Error: UPGRADE FAILED: pre-upgrade hooks failed: timed out waiting for the condition
helm.go:84: [debug] pre-upgrade hooks failed: timed out waiting for the condition
UPGRADE FAILED
main.newUpgradeCmd.func2
helm.sh/helm/v3/cmd/helm/upgrade.go:199
github.com/spf13/cobra.(*Command).execute
github.com/spf13/cobra@v1.3.0/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
github.com/spf13/cobra@v1.3.0/command.go:974
github.com/spf13/cobra.(*Command).Execute
github.com/spf13/cobra@v1.3.0/command.go:902
main.main
helm.sh/helm/v3/cmd/helm/helm.go:83
runtime.main
runtime/proc.go:255
runtime.goexit
runtime/asm_amd64.s:1581
PS C:\Users\<user>\Documents\CDI\jupyter> kubectl get events --sort-by='{.lastTimestamp}'
3m16s Warning FailedCreate job/hook-image-awaiter
Error creating: pods "hook-image-awaiter-" is forbidden: unable to validate against any security context constraint: [
provider "anyuid": Forbidden: not usable by user or serviceaccount,
spec.containers[0].securityContext.runAsUser: Invalid value: 65534: must be in the ranges: [1000690000, 1000699999],
provider "nonroot": Forbidden: not usable by user or serviceaccount,
provider "hostmount-anyuid": Forbidden: not usable by user or serviceaccount,
provider "machine-api-termination-handler": Forbidden: not usable by user or serviceaccount,
provider "hostnetwork": Forbidden: not usable by user or serviceaccount,
provider "hostaccess": Forbidden: not usable by user or serviceaccount,
provider "node-exporter": Forbidden: not usable by user or serviceaccount,
provider "privileged": Forbidden: not usable by user or serviceaccount]
2m58s Warning FailedCreate daemonset/hook-image-puller
Error creating: pods "hook-image-puller-" is forbidden: unable to validate against any security context constraint: [
provider "anyuid": Forbidden: not usable by user or serviceaccount,
spec.initContainers[0].securityContext.runAsUser: Invalid value: 65534: must be in the ranges: [1000690000, 1000699999],
spec.initContainers[1].securityContext.runAsUser: Invalid value: 65534: must be in the ranges: [1000690000, 1000699999],
spec.containers[0].securityContext.runAsUser: Invalid value: 65534: must be in the ranges: [1000690000, 1000699999],
provider "nonroot": Forbidden: not usable by user or serviceaccount,
provider "hostmount-anyuid": Forbidden: not usable by user or serviceaccount,
provider "machine-api-termination-handler": Forbidden: not usable by user or serviceaccount,
provider "hostnetwork": Forbidden: not usable by user or serviceaccount,
provider "hostaccess": Forbidden: not usable by user or serviceaccount,
provider "node-exporter": Forbidden: not usable by user or serviceaccount,
provider "privileged": Forbidden: not usable by user or serviceaccount]
The user is still 65534
.
I tried the same with runAsUser: 1000690042
. Same result: timeout due to security context constraint error.