2017-06-23 9 views
0

概要とポッドを作成することができません。Kubernetesは私がSecurityContextがrunAsUser

私が原因ポリシーで禁止されているに起動に失敗security context: runAsUser: 1337とポッドを持っています。私はアドミッションコントロールを成功しないように変更しました(herehere

このようなセキュリティコンテキストを強制するには、ほかに何が必要ですか?私はistioにオーバー移植を開始するhttps://istio.io/docs/samples/bookinfo.html例を通じて働いている

詳細

レプリカセットとポッドが作成されたdetails-v1という名前のデプロイメントがあります(下記参照)。ポッドは保留中です。ポッド上

NAME          READY  STATUS RESTARTS AGE 
details-v1-3207759430-nt9tt    0/2  Pending 0   34m 

describeエラーの原因を示しています

/usr/local/bin/kube-apiserver \ 
    --admission-control=NamespaceLifecycle,LimitRanger,ServiceAccount,ResourceQuota \ 
    --allow-privileged=true \ 

FailedValidation Error validating pod details-v1-3207759430-nt9tt.azs-master from api, ignoring: spec.initContainers[1].securityContext.privileged: Forbidden: disallowed by policy 

はるかにこれを取得するためには、私はすでにKUBE-apiserverに変更を加えました配置:

apiVersion: extensions/v1beta1 
kind: Deployment 
metadata: 
    annotations: 
    deployment.kubernetes.io/revision: "1" 
    kubectl.kubernetes.io/last-applied-configuration: | 
     {"apiVersion":"extensions/v1beta1","kind":"Deployment","metadata":{"annotations":{},"creationTimestamp":null,"name":"details-v1","namespace":"azs-master"},"spec":{"replicas":1,"strategy":{},"template":{"metadata":{"annotations":{"alpha.istio.io/sidecar":"injected","alpha.istio.io/version":"[email protected]","pod.beta.kubernetes.io/init-containers":"[{\"args\":[\"-p\",\"15001\",\"-u\",\"1337\"],\"image\":\"docker.io/istio/init:0.1\",\"imagePullPolicy\":\"Always\",\"name\":\"init\",\"securityContext\":{\"capabilities\":{\"add\":[\"NET_ADMIN\"]}}},{\"args\":[\"-c\",\"sysctl -w kernel.core_pattern=/tmp/core.%e.%p.%t \\u0026\\u0026 ulimit -c unlimited\"],\"command\":[\"/bin/sh\"],\"image\":\"alpine\",\"imagePullPolicy\":\"Always\",\"name\":\"enable-core-dump\",\"securityContext\":{\"privileged\":true}}]"},"creationTimestamp":null,"labels":{"app":"details","version":"v1"}},"spec":{"containers":[{"image":"istio/examples-bookinfo-details-v1","imagePullPolicy":"IfNotPresent","name":"details","ports":[{"containerPort":9080}],"resources":{}},{"args":["proxy","sidecar","-v","2"],"env":[{"name":"POD_NAME","valueFrom":{"fieldRef":{"fieldPath":"metadata.name"}}},{"name":"POD_NAMESPACE","valueFrom":{"fieldRef":{"fieldPath":"metadata.namespace"}}},{"name":"POD_IP","valueFrom":{"fieldRef":{"fieldPath":"status.podIP"}}}],"image":"docker.io/istio/proxy_debug:0.1","imagePullPolicy":"Always","name":"proxy","resources":{},"securityContext":{"runAsUser":1337},"volumeMounts":[{"mountPath":"/etc/certs","name":"istio-certs","readOnly":true}]}],"volumes":[{"name":"istio-certs","secret":{"secretName":"istio.default"}}]}}},"status":{}} 
    creationTimestamp: 2017-06-23T13:30:00Z 
    generation: 1 
    labels: 
    app: details 
    version: v1 
    name: details-v1 
    namespace: azs-master 
    resourceVersion: "29678612" 
    selfLink: /apis/extensions/v1beta1/namespaces/azs-master/deployments/details-v1 
    uid: 0eacea4a-5818-11e7-af0e-0a55ca98bb17 
spec: 
    replicas: 1 
    selector: 
    matchLabels: 
     app: details 
     version: v1 
    strategy: 
    rollingUpdate: 
     maxSurge: 1 
     maxUnavailable: 1 
    type: RollingUpdate 
    template: 
    metadata: 
     annotations: 
     alpha.istio.io/sidecar: injected 
     alpha.istio.io/version: [email protected] 
     pod.alpha.kubernetes.io/init-containers: '[{"name":"init","image":"docker.io/istio/init:0.1","args":["-p","15001","-u","1337"],"resources":{},"imagePullPolicy":"Always","securityContext":{"capabilities":{"add":["NET_ADMIN"]}}},{"name":"enable-core-dump","image":"alpine","command":["/bin/sh"],"args":["-c","sysctl 
      -w kernel.core_pattern=/tmp/core.%e.%p.%t \u0026\u0026 ulimit -c unlimited"],"resources":{},"imagePullPolicy":"Always","securityContext":{"privileged":true}}]' 
     pod.beta.kubernetes.io/init-containers: '[{"name":"init","image":"docker.io/istio/init:0.1","args":["-p","15001","-u","1337"],"resources":{},"imagePullPolicy":"Always","securityContext":{"capabilities":{"add":["NET_ADMIN"]}}},{"name":"enable-core-dump","image":"alpine","command":["/bin/sh"],"args":["-c","sysctl 
      -w kernel.core_pattern=/tmp/core.%e.%p.%t \u0026\u0026 ulimit -c unlimited"],"resources":{},"imagePullPolicy":"Always","securityContext":{"privileged":true}}]' 
     creationTimestamp: null 
     labels: 
     app: details 
     version: v1 
    spec: 
     containers: 
     - image: istio/examples-bookinfo-details-v1 
     imagePullPolicy: IfNotPresent 
     name: details 
     ports: 
     - containerPort: 9080 
      protocol: TCP 
     resources: {} 
     terminationMessagePath: /dev/termination-log 
     - args: 
     - proxy 
     - sidecar 
     - -v 
     - "2" 
     env: 
     - name: POD_NAME 
      valueFrom: 
      fieldRef: 
       apiVersion: v1 
       fieldPath: metadata.name 
     - name: POD_NAMESPACE 
      valueFrom: 
      fieldRef: 
       apiVersion: v1 
       fieldPath: metadata.namespace 
     - name: POD_IP 
      valueFrom: 
      fieldRef: 
       apiVersion: v1 
       fieldPath: status.podIP 
     image: docker.io/istio/proxy_debug:0.1 
     imagePullPolicy: Always 
     name: proxy 
     resources: {} 
     securityContext: 
      runAsUser: 1337 
     terminationMessagePath: /dev/termination-log 
     volumeMounts: 
     - mountPath: /etc/certs 
      name: istio-certs 
      readOnly: true 
     dnsPolicy: ClusterFirst 
     restartPolicy: Always 
     securityContext: {} 
     terminationGracePeriodSeconds: 30 
     volumes: 
     - name: istio-certs 
     secret: 
      defaultMode: 420 
      secretName: istio.default 
status: 
    conditions: 
    - lastTransitionTime: 2017-06-23T13:30:00Z 
    lastUpdateTime: 2017-06-23T13:30:00Z 
    message: Deployment has minimum availability. 
    reason: MinimumReplicasAvailable 
    status: "True" 
    type: Available 
    observedGeneration: 1 
    replicas: 1 
    unavailableReplicas: 1 
    updatedReplicas: 1 

Kubernetesサーバーのバージョン:1.5.6

答えて

1

保留中の状態は、これがKubletによってブロックされたことを示します。これには、--allow-privelegedフラグも必要です。

関連する問題