我正在使用Kubernetes执行器在一个共享集群中运行Nextflow工作流程,由于安全原因,该集群不允许特权容器。
当我运行我的Nextflow工作流程时,我收到一个错误,明确指出它正在尝试以特权模式运行我的作业。
Nextflow文档建议我可以在k8s.securityContext中设置privileged=false。我尝试了两个不同的值来将privileged设置为false(一个基于Nextflow文档的privileged,另一个基于Kubernetes文档的allowPrivilegeEscalation)。但是两者仍然产生相同的错误。
我看到以下相关讨论,似乎暗示这应该可以工作,但我很难理解这些讨论,或者至少这些讨论似乎表明我的
更新:
当Nextflow提交我的作业时,这是Kubernetes接收到的yaml的样子。看起来作业的安全上下文是空的,但是Pod模板中的
我还注意到我尝试在
看起来我只需要弄清楚如何从
当我运行我的Nextflow工作流程时,我收到一个错误,明确指出它正在尝试以特权模式运行我的作业。
job-controller Error creating: admission webhook "validation.gatekeeper.sh" denied the request:
[psp-privileged-container] Privileged container is not allowed: nf-f48d29c6300b8f61af05447de0072d69,
securityContext: {"privileged": true}
Nextflow文档建议我可以在k8s.securityContext中设置privileged=false。我尝试了两个不同的值来将privileged设置为false(一个基于Nextflow文档的privileged,另一个基于Kubernetes文档的allowPrivilegeEscalation)。但是两者仍然产生相同的错误。
// Kubernetes config
process.executor = 'k8s'
k8s.namespace = 'mynamespace'
k8s.computeResourceType = 'Job'
k8s.securityContext.privileged = false // nextflow doc format
k8s.securityContext.allowPrivilegeEscalation = false // k8s doc format
我看到以下相关讨论,似乎暗示这应该可以工作,但我很难理解这些讨论,或者至少这些讨论似乎表明我的
nextflow.config
是正确的。
[ERROR controller-runtime.controller - 不允许特权容器 spec.containers[1].securityContext.privileged #792][1]
[feat: 为运行容器任意设置 privileged: true #1383][2]
更新:
当Nextflow提交我的作业时,这是Kubernetes接收到的yaml的样子。看起来作业的安全上下文是空的,但是Pod模板中的
spec.template.spec.containers[0].securityContext.privileged = true
。我还注意到我尝试在
nextflow.config
中设置k8s.containers.securityContext.privileged = false
,但这是一个错误的猜测,我不知道如何索引到Pod模板的设置。看起来我只需要弄清楚如何从
nextflow.config
引用Pod模板的securityContext
。$ kubectl get job nf-878eb722258681cf0031aeeabe2fb132 -n mynamespace -o yaml
apiVersion: batch/v1
kind: Job
metadata:
annotations:
batch.kubernetes.io/job-tracking: ""
creationTimestamp: "2023-09-12T17:16:58Z"
generation: 1
labels:
nextflow.io/app: nextflow
nextflow.io/processName: helloWorld1
nextflow.io/runName: focused_pesquet
nextflow.io/sessionId: uuid-2a634652-ba40-4905-a9ca-ad0b948df4f0
nextflow.io/taskName: helloWorld1
name: nf-878eb722258681cf0031aeeabe2fb132
namespace: mynamespace
resourceVersion: "6387865826"
uid: 6a4ce939-cc01-4298-9d94-84219d750e84
spec:
backoffLimit: 0
completionMode: NonIndexed
completions: 1
parallelism: 1
selector:
matchLabels:
controller-uid: 6a4ce939-cc01-4298-9d94-84219d750e84
suspend: false
template:
metadata:
creationTimestamp: null
labels:
controller-uid: 6a4ce939-cc01-4298-9d94-84219d750e84
job-name: nf-878eb722258681cf0031aeeabe2fb132
spec:
containers:
- args:
- /usr/bin/fusion
- bash
- /fusion/s3/mybucket/nextflow/87/8eb722258681cf0031aeeabe2fb132/.command.run
env:
- name: FUSION_WORK
value: /fusion/s3/mybucket/nextflow/87/8eb722258681cf0031aeeabe2fb132
- name: AWS_S3_ENDPOINT
value: custom.ceph.endpoint
- name: FUSION_TAGS
value: '[.command.*|.exitcode|.fusion.*](nextflow.io/metadata=true),[*](nextflow.io/temporary=true)'
image: wave.seqera.io/wt/8602f8b269fe/library/ubuntu:latest
imagePullPolicy: Always
name: nf-878eb722258681cf0031aeeabe2fb132
resources:
limits:
ephemeral-storage: 1Gi
memory: 1Gi
requests:
cpu: "1"
ephemeral-storage: 1Gi
memory: 1Gi
securityContext:
privileged: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Never
schedulerName: default-scheduler
securityContext: {}
serviceAccount: default
serviceAccountName: default
terminationGracePeriodSeconds: 30
ttlSecondsAfterFinished: 604800
status:
ready: 0
startTime: "2023-09-12T17:16:58Z"
uncountedTerminatedPods: {}
``
[1]: https://github.com/actions/actions-runner-controller/issues/792
[2]: https://github.com/actions/actions-runner-controller/pull/1383
无法将对象 <YAML-STRING> 从类 'java.lang.String' 转换为类 'java.util.List'
。我正在尝试弄清楚它对pod
期望的是什么。除非这里有人知道,否则我可能不得不开始深入代码,因为文档没有涉及到这个层面。 - undefined