Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Docker 带特权旗的Kubernetes yaml_Docker_Kubernetes - Fatal编程技术网

Docker 带特权旗的Kubernetes yaml

Docker 带特权旗的Kubernetes yaml,docker,kubernetes,Docker,Kubernetes,我正在尝试创建与以下内容匹配的K8yaml文件: docker run --privileged 我在我的K8yaml中尝试的内容: apiVersion: apps/v1 kind: Deployment metadata: name: my-deployment spec: privileged: true .... 但是当我试图运行kubectl apply-f my.yaml时,我得到了以下错误: 错误:验证“my.yaml”时出错:验证数据时出错:ValidationErr

我正在尝试创建与以下内容匹配的
K8
yaml文件:

docker run --privileged
我在我的
K8
yaml中尝试的内容:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-deployment
spec:
  privileged: true
....
但是当我试图运行
kubectl apply-f my.yaml
时,我得到了以下错误:

错误:验证“my.yaml”时出错:验证数据时出错:ValidationError(Deployment.spec): io.k8s.api.apps.v1.DeploymentSpec中的未知字段“privileged”;如果选择忽略这些错误,请使用--validate关闭验证 =错误


如何使用
privileged
标志创建yaml部署文件?

privileged:true
需要位于pod模板规范部分的
securityContext

apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-deployment
  labels:
    app: test
spec:
  replicas: 3
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
        - name:  pause
          image: k8s.gcr.io/pause
          securityContext:
            privileged: true