OpenShift での Anypoint Platform PCE のインストール

Anypoint Platform Private Cloud Edition (Anypoint Platform PCE) を OpenShift にインストールする前に、Security Context Constraints (SCC) を設定してポッドに必要な権限を付与し、Prometheus のロールを作成してサービスからメトリクスを収集できるようにしてください。これらの設定が完了したら、Anypoint Platform PCE のインストールを進めます。

Anypoint Platform PCE をインストールする前に、運用可能な OpenShift クラスターを用意しておく必要があります。まだ設定していない場合は、OpenShift のドキュメントを参照して設定してください。

Anypoint Platform PCE のインストールを実行するには、MuleSoft Professional Services に連絡してください。

OpenShift 環境の設定

OpenShift 環境を設定するには、Security Context Constraints (SCC) と Prometheus のロールを設定してください。

Security Context Constraints (SCC) の設定

以下のスニペットは、SCC を設定するものです。

apiVersion: security.openshift.io/v1
kind: SecurityContextConstraints
metadata:
  name: anypoint-anyuid
allowHostDirVolumePlugin: false
allowHostIPC: false
allowHostNetwork: false
allowHostPID: false
allowHostPorts: false
allowPrivilegeEscalation: true
allowPrivilegedContainer: false
allowedCapabilities: null
defaultAddCapabilities: null
fsGroup:
  type: RunAsAny
users: []
groups: []
readOnlyRootFilesystem: false
requiredDropCapabilities:
  - MKNOD
runAsUser:
  type: RunAsAny
seLinuxContext:
  type: MustRunAs
seccompProfiles:
  - runtime/default
supplementalGroups:
  type: RunAsAny
volumes:
  - configMap
  - csi
  - downwardAPI
  - emptyDir
  - ephemeral
  - persistentVolumeClaim
  - projected
  - secret
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: anypoint-scc
  namespace: default
rules:
  - apiGroups: [ "security.openshift.io" ]
    resourceNames:
      - anypoint-anyuid
    resources: [ "securitycontextconstraints" ]
    verbs: [ "use" ]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: anypoint-scc
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: anypoint-scc
subjects:
  - kind: ServiceAccount
    name: anypoint-install
    namespace: default
  - kind: ServiceAccount
    name: anypoint-install
    namespace: dias
  - kind: ServiceAccount
    name: default
    namespace: pce
  - kind: ServiceAccount
    name: default
    namespace: access-management
  - kind: ServiceAccount
    name: authentication-server-service-account
    namespace: access-management
  - kind: ServiceAccount
    name: default
    namespace: design-center
  - kind: ServiceAccount
    name: default
    namespace: api-console-proxy
  - kind: ServiceAccount
    name: default
    namespace: amf
  - kind: ServiceAccount
    name: default
    namespace: arm
  - kind: ServiceAccount
    name: default
    namespace: api-manager
  - kind: ServiceAccount
    name: default
    namespace: mozart
  - kind: ServiceAccount
    name: default
    namespace: mocking
  - kind: ServiceAccount
    name: default
    namespace: api-manager
  - kind: ServiceAccount
    name: default
    namespace: audit-log
  - kind: ServiceAccount
    name: default
    namespace: trusted-domains
  - kind: ServiceAccount
    name: default
    namespace: api-designer
  - kind: ServiceAccount
    name: monitoring
    namespace: pce
  - kind: ServiceAccount
    name: default
    namespace: exchange
  - kind: ServiceAccount
    name: xapi-service-deployment-manager
    namespace: exchange
  - kind: ServiceAccount
    name: default
    namespace: core-paas
  - kind: ServiceAccount
    name: default
    namespace: monitoring-center
  - kind: ServiceAccount
    name: default
    namespace: visualizer
  - kind: ServiceAccount
    name: secrets-robot
    namespace: dias
  - kind: ServiceAccount
    name: default
    namespace: dias
  - kind: ServiceAccount
    name: default
    namespace: amc
  - kind: Group
    name: system:serviceaccounts:monitoring
  - kind: ServiceAccount
    name: default
    namespace: anypoint-flash

このファイルを ​openshift-scc.yaml​ として保存し、OpenShift クラスターに適用してください。

oc apply -f openshift-scc.yaml

Prometheus のロールの設定

Prometheus は Anypoint Platform PCE サービスからメトリクスを収集するための特定のロールを必要とします。以下のスニペットは、必要なロールを設定するものです。

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: pce-prometheus
rules:
  - apiGroups:
      - ""
    resources:
      - endpoints
      - pods
      - services
      - nodes
      - secrets
    verbs:
      - get
      - list
      - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: pce-prometheus
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: pce-prometheus
subjects:
  - kind: ServiceAccount
    name: prometheus-k8s
    namespace: openshift-monitoring

このファイルを ​openshift-monitoring.yaml​ として保存し、OpenShift クラスターに適用してください。

oc apply -f openshift-monitoring.yaml

OpenShift への Anypoint Platform PCE のインストール

以下のスニペットは、OpenShift クラスターに Anypoint Platform PCE をデプロイするためのインストールマニフェストの例を提供します。

containerRegistry:
  endpoint: registry.pce.example.com
  username: username
  password: password
  certificate: ''
  subproject: example
  tlsSkipVerify: true
postInstallConfiguration:
  platformDNS: anypoint.pce.example.com
  fileSystemDNS: fs.pce.example.com
  firstUserAccount:
    organizationName: Example Org
    username: username
    email: username@mulesoft.com
    password: password
  platformCertificate: cert.pem
  platformCertificateKey: key.pem
amvInstallConfiguration:
  enabled: false
storageConfiguration:
  pceobjectstore:
    type: persistentVolumeClaim
    storageClass: example-csi
  stolon:
    type: persistentVolumeClaim
    storageClass: example-csi
monitoringAppConfiguration:
  monitoringStackEnabled: false
  grafana:
    enabled: true
    values: |
      datasources:
        datasources.yaml:
          apiVersion: 1
          datasources:
          - name: Prometheus
            type: prometheus
            url: https://prometheus-k8s.openshift-monitoring.svc:9091
            access: proxy
            isDefault: true
            jsonData:
              tlsSkipVerify: true
              httpHeaderName1: 'Authorization'
            secureJsonData:
              httpHeaderValue1: 'Bearer <Token>'

このスニペットの ​monitoringAppConfiguration​ セクションに注意してください。このセクションでは、Anypoint Platform PCE の監視スタックを無効にし、Grafana アプリケーションのみを有効にしています。OpenShift にはデフォルトで Prometheus が含まれているため、監視スタックを無効にすることをお勧めします。Grafana を有効にして、Prometheus に接続するようにデータソースを設定します。

Prometheus に接続するためのトークンを取得するには、このコマンドを実行します。

oc create token prometheus-k8s -n openshift-monitoring --duration=87600h

インストールが完了したら、以下のコマンドを実行して、OpenShift の Prometheus がプラットフォームサービスからメトリクスを収集できるようにしてください。

oc label namespace default openshift.io/cluster-monitoring="true" --overwrite
oc label namespace pce openshift.io/cluster-monitoring="true" --overwrite