如何更改Jenkins Kubernetes插件中pod的securityContext。例如,在Docker环境中以特权模式在Docker映像中运行docker。
答案 0 :(得分:1)
我相信this应该有效(根据文档):
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
apiVersion: v1
kind: Pod
metadata:
labels:
some-label: some-label-value
spec:
containers:
- name: busybox
image: busybox
command:
- cat
tty: true
securityContext:
allowPrivilegeEscalation: true
"""
) {
node (label) {
container('busybox') {
sh "hostname"
}
}
}