5 インスタンスのプロビジョニング
この項では、Blockchain Platform Managerを使用してOracle Blockchain Platformインスタンスをプロビジョニングする方法について説明します。
Oracle Blockchain Platformインスタンスを作成する前に
Oracle Blockchain Platformをプロビジョニングする前に、開発者またはエンタープライズ・インスタンスがニーズを満たしているかどうかを判断します。
使用するプロビジョニング・シェイプの決定
インスタンスをプロビジョニングする際に、2つの構成から選択します。これらのオプション間の移行は現在サポートされていません。
| 構成 | 機能 |
|---|---|
| 開発者 このスタータ・シェイプは、開発および評価に使用することをお薦めします。 |
|
| エンタープライズ 各サービスのレプリカ数が多い高可用性インスタンス構成。 |
|
Blockchain Platform Managerを使用したインスタンスのプロビジョニング
Blockchain Platform Managerでブロックチェーン・ファウンダまたは参加者インスタンスを作成するには、新規インスタンスの作成ウィザードを使用します。
-
ファウンダ組織: 参加者が後で参加できる新しいネットワークを含む、完全なブロックチェーン環境。
-
参加者インスタンス: 参加するファウンダ組織がすでに存在する場合は、資格証明によってネットワークへのアクセス権が付与されていれば、参加者インスタンスを作成できます。参加者は単独では機能できないことに注意してください。
プロビジョニングの前提条件
kubectl get virtualservice -n <instance-namespace> -o json | jq -r
.items[].spec.hosts[0]kubectl get virtualservice -n <instance-namespace> -o json | jq -r
.items[].spec.hosts[0]Oracle Blockchain Platform Enterprise Editionインスタンスを作成した後、コンポーネントのパブリック・ホスト名をOpenShiftローカル・ネットワークから解決できるようにDNSを構成する必要があります。
- 次のコマンドを実行します
oc new-project obp-coredns - 次のコマンドを実行して、カスタム
corednsサーバーをobp-corednsネームスペースにデプロイします。
次のマニフェストファイルをコマンドとともに使用します。kubectl apply -f <coredns-deployment-yaml-file>apiVersion: v1 kind: ConfigMap metadata: name: coredns namespace: obp-coredns data: Corefile: |- .:1053 { errors health { lameduck 5s } ready kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure fallthrough in-addr.arpa ip6.arpa } prometheus :9153 forward . /etc/resolv.conf cache 30 loop reload loadbalance } import custom/*.server --- apiVersion: apps/v1 kind: Deployment metadata: labels: app: obp-coredns name: obp-coredns namespace: obp-coredns spec: progressDeadlineSeconds: 600 replicas: 1 revisionHistoryLimit: 10 selector: matchLabels: app: obp-coredns strategy: type: RollingUpdate template: metadata: labels: app: obp-coredns spec: containers: - args: - -conf - /etc/coredns/Corefile image: docker.io/coredns/coredns:latest imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: path: /health port: 8080 scheme: HTTP initialDelaySeconds: 60 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 name: coredns ports: - containerPort: 1053 name: dns protocol: UDP - containerPort: 1053 name: dns-tcp protocol: TCP - containerPort: 9153 name: metrics protocol: TCP readinessProbe: failureThreshold: 3 httpGet: path: /ready port: 8181 scheme: HTTP periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 resources: limits: memory: 170Mi requests: cpu: 100m memory: 70Mi securityContext: allowPrivilegeEscalation: false capabilities: add: - NET_BIND_SERVICE drop: - all readOnlyRootFilesystem: true terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /etc/coredns name: config-volume readOnly: true - mountPath: /etc/coredns/custom name: custom-config-volume readOnly: true dnsPolicy: Default restartPolicy: Always schedulerName: default-scheduler securityContext: {} serviceAccount: obp-coredns serviceAccountName: obp-coredns terminationGracePeriodSeconds: 30 volumes: - configMap: defaultMode: 420 items: - key: Corefile path: Corefile name: coredns name: config-volume - configMap: defaultMode: 420 name: coredns-custom optional: true name: custom-config-volume --- apiVersion: v1 kind: Service metadata: labels: app: obp-coredns name: obp-coredns namespace: obp-coredns spec: ports: - name: dns port: 53 protocol: UDP targetPort: 1053 - name: dns-tcp port: 53 protocol: TCP targetPort: 1053 - name: metrics port: 9153 protocol: TCP targetPort: 9153 selector: app: obp-coredns sessionAffinity: None type: ClusterIP --- apiVersion: v1 kind: ServiceAccount metadata: name: obp-coredns namespace: obp-coredns --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: obp-coredns rules: - apiGroups: - "" resources: - endpoints - services - pods - namespaces verbs: - list - watch - apiGroups: - "" resources: - nodes verbs: - get - apiGroups: - discovery.k8s.io resources: - endpointslices verbs: - list - watch --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: obp-coredns roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: obp-coredns subjects: - kind: ServiceAccount name: obp-coredns namespace: obp-coredns - ブロックチェーン・インスタンスのYAML形式で
coredns-custom-configmapファイルを作成します。
前述の例では、apiVersion: v1 kind: ConfigMap metadata: name: coredns-custom namespace: obp-coredns data: obp.server: |2 <instanceName>.<domain>:1053 { log kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure fallthrough in-addr.arpa ip6.arpa } rewrite stop { name regex (.*)\.<instanceName>\.<domain>\.com istio-ingressgateway.istio-system.svc.cluster.local answer auto } forward . /etc/resolv.conf }<instanceName>はインスタンスの名前、<domain>はインスタンスの作成時に渡されるドメインです。 - 次のコマンドを実行して、カスタム
ConfigMapオブジェクトを適用します。kubectl apply -f <coredns-custom-configmap-yaml-file> - 次のコマンドを実行して、クラスタのIPアドレスを取得します。その IP アドレスを記録します。
kubectl get svc -n obp-coredns - 次のコマンドを実行して、OpenShift DNSカスタム・リソースを編集します。
kubectl edit dnses.operator/default - 次の例に示すように、DNSカスタム・リソースのzonesセクションを更新して、インスタンス名とドメイン名を使用します。
前述の例では、## Add the following section to the dns custom resource under spec servers: - forwardPlugin: policy: Random upstreams: - 192.0.2.233 name: obp-server zones: - <instanceName>.<domain><instanceName>はインスタンスの名前、<domain>は親ドメインです。 - 新しいインスタンスを追加するには、次の例に示すように、
coredns-custom-configmapファイルにエントリを追加し、新しいインスタンスのドメインのOpenShift DNSカスタム・リソースを更新します。
Blockchain Platform Manager for DNSの変更を有効にするには、Blockchain Platformインスタンスを停止して再起動する必要があります。apiVersion: v1 kind: ConfigMap metadata: name: coredns-custom namespace: obp-coredns data: obp.server: |2 myobp.example.com:1053 { log kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure fallthrough in-addr.arpa ip6.arpa } rewrite stop { name regex (.*)\.myobp\.example\.com istio-ingressgateway.istio-system.svc.cluster.local answer auto } forward . /etc/resolv.conf } otherobp.example.org:1053 { log kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure fallthrough in-addr.arpa ip6.arpa } rewrite stop { name regex (.*)\.otherobp\.example\.org istio-ingressgateway.istio-system.svc.cluster.local answer auto } forward . /etc/resolv.conf } ## Edit the Openshift's DNS custom resource kubectl edit dnses.operator/default ## Add the new instance domain to the existing .spec.servers.zones servers: - forwardPlugin: policy: Random upstreams: - 192.0.2.233 name: obp-server zones: - myobp.example.com - otherobp.example.org
DNS の構成
Oracle Blockchain Platform Enterprise Editionインスタンスを作成した後、コンポーネントのパブリック・ホスト名をOpenShiftローカル・ネットワークから解決できるようにDNSを構成する必要があります。
- 次のコマンドを実行します
oc new-project obp-coredns - 次のコマンドを実行して、カスタム
corednsサーバーをobp-corednsネームスペースにデプロイします。
次のマニフェストファイルをコマンドとともに使用します。kubectl apply -f <coredns-deployment-yaml-file>apiVersion: v1 kind: ConfigMap metadata: name: coredns namespace: obp-coredns data: Corefile: |- .:1053 { errors health { lameduck 5s } ready kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure fallthrough in-addr.arpa ip6.arpa } prometheus :9153 forward . /etc/resolv.conf cache 30 loop reload loadbalance } import custom/*.server --- apiVersion: apps/v1 kind: Deployment metadata: labels: app: obp-coredns name: obp-coredns namespace: obp-coredns spec: progressDeadlineSeconds: 600 replicas: 1 revisionHistoryLimit: 10 selector: matchLabels: app: obp-coredns strategy: type: RollingUpdate template: metadata: labels: app: obp-coredns spec: containers: - args: - -conf - /etc/coredns/Corefile image: docker.io/coredns/coredns:latest imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 5 httpGet: path: /health port: 8080 scheme: HTTP initialDelaySeconds: 60 periodSeconds: 10 successThreshold: 1 timeoutSeconds: 5 name: coredns ports: - containerPort: 1053 name: dns protocol: UDP - containerPort: 1053 name: dns-tcp protocol: TCP - containerPort: 9153 name: metrics protocol: TCP readinessProbe: failureThreshold: 3 httpGet: path: /ready port: 8181 scheme: HTTP periodSeconds: 10 successThreshold: 1 timeoutSeconds: 1 resources: limits: memory: 170Mi requests: cpu: 100m memory: 70Mi securityContext: allowPrivilegeEscalation: false capabilities: add: - NET_BIND_SERVICE drop: - all readOnlyRootFilesystem: true terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /etc/coredns name: config-volume readOnly: true - mountPath: /etc/coredns/custom name: custom-config-volume readOnly: true dnsPolicy: Default restartPolicy: Always schedulerName: default-scheduler securityContext: {} serviceAccount: obp-coredns serviceAccountName: obp-coredns terminationGracePeriodSeconds: 30 volumes: - configMap: defaultMode: 420 items: - key: Corefile path: Corefile name: coredns name: config-volume - configMap: defaultMode: 420 name: coredns-custom optional: true name: custom-config-volume --- apiVersion: v1 kind: Service metadata: labels: app: obp-coredns name: obp-coredns namespace: obp-coredns spec: ports: - name: dns port: 53 protocol: UDP targetPort: 1053 - name: dns-tcp port: 53 protocol: TCP targetPort: 1053 - name: metrics port: 9153 protocol: TCP targetPort: 9153 selector: app: obp-coredns sessionAffinity: None type: ClusterIP --- apiVersion: v1 kind: ServiceAccount metadata: name: obp-coredns namespace: obp-coredns --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: obp-coredns rules: - apiGroups: - "" resources: - endpoints - services - pods - namespaces verbs: - list - watch - apiGroups: - "" resources: - nodes verbs: - get - apiGroups: - discovery.k8s.io resources: - endpointslices verbs: - list - watch --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: obp-coredns roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: obp-coredns subjects: - kind: ServiceAccount name: obp-coredns namespace: obp-coredns - ブロックチェーン・インスタンスのYAML形式で
coredns-custom-configmapファイルを作成します。
前述の例では、apiVersion: v1 kind: ConfigMap metadata: name: coredns-custom namespace: obp-coredns data: obp.server: |2 <instanceName>.<domain>:1053 { log kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure fallthrough in-addr.arpa ip6.arpa } rewrite stop { name regex (.*)\.<instanceName>\.<domain>\ istio-ingressgateway.istio-system.svc.cluster.local answer auto } forward . /etc/resolv.conf }<instanceName>はインスタンスの名前、<domain>は親ドメインです。 - 次のコマンドを実行して、カスタムの
ConfigMapオブジェクトを適用します。kubectl apply -f <coredns-custom-configmap-yaml-file> - 次のコマンドを実行して、クラスタのIPアドレスを取得します。その IP アドレスを記録します。
kubectl get svc -n obp-coredns - 次のコマンドを実行して、OpenShift DNSカスタム・リソースを編集します。
kubectl edit dnses.operator/default - 次の例に示すように、DNSカスタム・リソースのzonesセクションを更新して、インスタンス名とドメイン名を使用します。
前述の例では、## Add the following section to the dns custom resource under spec servers: - forwardPlugin: policy: Random upstreams: - 192.0.2.233 name: obp-server zones: - <instanceName>.<domain><instanceName>はインスタンスの名前、<domain>は親ドメインです。 - 新しいインスタンスを追加するには、次の例に示すように、
coredns-custom-configmapファイルにエントリを追加し、新しいインスタンスのドメインのOpenShift DNSカスタム・リソースを更新します。
DNSの変更を有効にするには、インスタンスを停止して再起動する必要があります。apiVersion: v1 kind: ConfigMap metadata: name: coredns-custom namespace: obp-coredns data: obp.server: |2 myobp.example.com:1053 { log kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure fallthrough in-addr.arpa ip6.arpa } rewrite stop { name regex (.*)\.myobp\.example\.com istio-ingressgateway.istio-system.svc.cluster.local answer auto } forward . /etc/resolv.conf } otherobp.example.org:1053 { log kubernetes cluster.local in-addr.arpa ip6.arpa { pods insecure fallthrough in-addr.arpa ip6.arpa } rewrite stop { name regex (.*)\.otherobp\.example\.org istio-ingressgateway.istio-system.svc.cluster.local answer auto } forward . /etc/resolv.conf } ## Edit the Openshift's DNS custom resource kubectl edit dnses.operator/default ## Add the new instance domain to the existing .spec.servers.zones servers: - forwardPlugin: policy: Random upstreams: - 192.0.2.233 name: obp-server zones: - myobp.example.com - otherobp.example.org
kubectl get virtualservice -n <instance-namespace> -o json | jq -r
.items[].spec.hosts[0]クラスタへのノードの追加
- 次のコマンドを実行して、「保留中」状態のポッドを確認します:
さらに、使用可能なポッドがないことを確認できます:kubectl get pods -n <instancename> | grep Pendingkubectl get pods -n instancename - 次に、使用可能なワーカー・ノードを確認します。
kubectl get nodes | grep worker - 新しいポッドを取得するために使用できるノードがあるかどうかを確認するには、各ワーカー・ノードに対して次のコマンドを実行します:
ここで、<worker_node>はワーカー・ノードの名前です。ワーカー・ノードが100%の容量を超えないようにしてください。kubectl describe node $<worker_node> - ノードを追加するには、最初にクラスタ内のMachineSetsの数を取得します。
oc get machinesets -n openshift-machine-api - ノードが2つ未満のMachineSetsの場合は、それらをスケール・アップしてみてください。
<obpee00-qtthx-worker-eastus2>は、2ノードまでスケール・アップするMachineSetの名前の例です。oc scale --replicas=2 machineset <obpee00-qtthx-worker-eastus2> -n openshift-machine-api - 準備完了および使用可能なノードのリストが、選択したノード数に達するまで、MachineSetsを再度問い合せます。
- これで、失敗したインスタンスを再デプロイできます。
インスタンスが作成され、インスタンス・リストに表示されたら、インスタンス名の横にあるメニューからサービス・コンソールを起動できます。Oracle Blockchain Platformの使用のコンソールとはの説明に従って、コンソールを使用してネットワークを構成します。