Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

27.4.2.3. Cinder ボリュームのセキュリティー

お使いのアプリケーションで Cinder PV を使用する場合に、そのデプロイメント設定にセキュリティーを追加します。

注記

Cinder ボリュームを実装する前に、ボリュームのセキュリティー を確認します。

  1. 適切な fsGroup ストラテジーを使用する SCC を作成します。
  2. サービスアカウントを作成して、そのアカウントを SCC に追加します。

    [source,bash]
    $ oc create serviceaccount <service_account>
    $ oc adm policy add-scc-to-user <new_scc> -z <service_account> -n <project>
  3. アプリケーションのデプロイ設定で、サービスアカウント名と securityContext を指定します。

    apiVersion: v1
    kind: ReplicationController
    metadata:
      name: frontend-1
    spec:
      replicas: 1  1
      selector:    2
        name: frontend
      template:    3
        metadata:
          labels:  4
            name: frontend 5
        spec:
          containers:
          - image: openshift/hello-openshift
            name: helloworld
            ports:
            - containerPort: 8080
              protocol: TCP
          restartPolicy: Always
          serviceAccountName: <service_account> 6
          securityContext:
            fsGroup: 7777 7
    1
    実行する Pod のコピー数です。
    2
    実行する Pod のラベルセレクターです。
    3
    コントローラーが作成する Pod のテンプレートです。
    4
    Pod のラベルには、ラベルセレクターからのラベルが含まれている必要があります。
    5
    パラメーターの拡張後の名前の最大長さは 63 文字です。
    6
    作成したサービスアカウントを指定します。
    7
    Pod の fsGrou を指定します。