LoginSignup
1
1

More than 1 year has passed since last update.

IKS を使用したデリバリー・パイプライン プライベート・ワーカー構成方法の確認

Last updated at Posted at 2022-09-24

はじめに

Continuous Delivery のツールチェーンを IKS(IBM Cloud Kubernetes Service) を使用して プライベート・ワーカーで稼働する方法を確認しました。

  参考:Delivery Pipeline プライベート・ワーカーのインストール


利用ケース

・IBM Cloud でツールチェーンをプライベート・ネットワークで使用したい場合など

*当方の例では、Internet 接続でない Power Systems Virtual Server (PowerVS) の VM に対してツールチェーンの実行で操作するために構成しました。

(PowerVS はIBM Cloud 内ではコロケーション構成のため、IBM Cloud のプライベートネットワークとは直接は接続ができません。PowerVS のクラウド接続を設定し、IKS がある IBM Cloud ネットワークと接続している構成です。)


環境の前提

・IBM Cloud のアカウントを保持し、該当のサービスを作成できる権限が付与されている

・IKS (IBM Cloud Kubernetes Service) が存在している

  参考: Kubernetes クラスターの作成

無料枠でも作成可能でした。

・Continuous Delivery サービスが作成されている

  参考:Continuous Delivery サービス・インスタンスの作成

・ツールチェーンが作成されている
  確認した環境ではBuild your own ツールチェーンで空のツールチェーンを作成しています。

  参考:ツールチェーンの作成


Delivery Pipeline プライベート・ワーカーの構成

・ 作成する対象のツールチェーン追加を押し、ツール統合の追加でDelivery Pipeline プライベート・ワーカーを選択します。

図1.png

図1.png

名前、サービスAPIキーを入力します。
使用するサービスAPIキーが存在しない場合は新規作成します。

図2.png

OK を押してサービスID の API キーを作成します。

図3.png

後で使用するためサービスAPIキーをコピーして保管します。
「統合の作成」を押します。

図4.png

ツールチェーンに Delivery Pipeline プライベート・ワーカーが登録されました。

図13.png


作成した "toolchain-test" を選択します。
「始めに」に移動します。

図6.png

図7.png

上で作成(もしくは指定)したサービスIDのAPI鍵の値、ワーカー名を入力します。
「生成」を押すと、画面下にコマンドが表示されます。

図8.png

図9.png

ワーカーノードを使用する対象の IKS にログインして上で生成されたコマンドを実行します。

# ibmcloud ks cluster config --cluster <対象クラスター>

Delivery Pipeline のプライベート・ワーカー・サポートのインストール

$ kubectl apply --filename "https://private-worker-service.jp-tok.devops.cloud.ibm.com/install?type=iks&olm=false"
namespace/tekton-pipelines created
Warning: policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+
podsecuritypolicy.policy/tekton-pipelines created
clusterrole.rbac.authorization.k8s.io/tekton-pipelines-controller-cluster-access created
clusterrole.rbac.authorization.k8s.io/tekton-pipelines-controller-tenant-access created
clusterrole.rbac.authorization.k8s.io/tekton-pipelines-webhook-cluster-access created
role.rbac.authorization.k8s.io/tekton-pipelines-controller created
role.rbac.authorization.k8s.io/tekton-pipelines-webhook created
role.rbac.authorization.k8s.io/tekton-pipelines-leader-election created
role.rbac.authorization.k8s.io/tekton-pipelines-info created
serviceaccount/tekton-pipelines-controller created
serviceaccount/tekton-pipelines-webhook created
clusterrolebinding.rbac.authorization.k8s.io/tekton-pipelines-controller-cluster-access created
clusterrolebinding.rbac.authorization.k8s.io/tekton-pipelines-controller-tenant-access created
clusterrolebinding.rbac.authorization.k8s.io/tekton-pipelines-webhook-cluster-access created
rolebinding.rbac.authorization.k8s.io/tekton-pipelines-controller created
rolebinding.rbac.authorization.k8s.io/tekton-pipelines-webhook created
rolebinding.rbac.authorization.k8s.io/tekton-pipelines-controller-leaderelection created
rolebinding.rbac.authorization.k8s.io/tekton-pipelines-webhook-leaderelection created
rolebinding.rbac.authorization.k8s.io/tekton-pipelines-info created
customresourcedefinition.apiextensions.k8s.io/clustertasks.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/pipelines.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/pipelineruns.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/resolutionrequests.resolution.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/pipelineresources.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/runs.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/tasks.tekton.dev created
customresourcedefinition.apiextensions.k8s.io/taskruns.tekton.dev created
secret/webhook-certs created
validatingwebhookconfiguration.admissionregistration.k8s.io/validation.webhook.pipeline.tekton.dev created
mutatingwebhookconfiguration.admissionregistration.k8s.io/webhook.pipeline.tekton.dev created
validatingwebhookconfiguration.admissionregistration.k8s.io/config.webhook.pipeline.tekton.dev created
clusterrole.rbac.authorization.k8s.io/tekton-aggregate-edit created
clusterrole.rbac.authorization.k8s.io/tekton-aggregate-view created
configmap/config-artifact-bucket created
configmap/config-artifact-pvc created
configmap/config-defaults created
configmap/feature-flags created
configmap/pipelines-info created
configmap/config-leader-election created
configmap/config-logging created
configmap/config-observability created
configmap/config-registry-cert created
deployment.apps/tekton-pipelines-controller created
service/tekton-pipelines-controller created
Warning: autoscaling/v2beta1 HorizontalPodAutoscaler is deprecated in v1.22+, unavailable in v1.25+; use autoscaling/v2 HorizontalPodAutoscaler
horizontalpodautoscaler.autoscaling/tekton-pipelines-webhook created
deployment.apps/tekton-pipelines-webhook created
service/tekton-pipelines-webhook created
customresourcedefinition.apiextensions.k8s.io/batchpolls.devops.cloud.ibm.com created
customresourcedefinition.apiextensions.k8s.io/cryptodetectors.devops.cloud.ibm.com created
customresourcedefinition.apiextensions.k8s.io/pwtaskruns.devops.cloud.ibm.com created
customresourcedefinition.apiextensions.k8s.io/localpipelines.devops.cloud.ibm.com created
customresourcedefinition.apiextensions.k8s.io/workeragents.devops.cloud.ibm.com created
customresourcedefinition.apiextensions.k8s.io/pwaconfigs.devops.cloud.ibm.com created
customresourcedefinition.apiextensions.k8s.io/taskpayloads.devops.cloud.ibm.com created
configmap/private-worker-agent-config-defaults created
deployment.apps/private-worker-agent created
role.rbac.authorization.k8s.io/private-worker-agent created
rolebinding.rbac.authorization.k8s.io/private-worker-agent created
serviceaccount/private-worker-agent created
clusterrolebinding.rbac.authorization.k8s.io/pwa-manager-rolebinding created
clusterrole.rbac.authorization.k8s.io/manager-role created
namespace/cd-tekton-agent-system created
customresourcedefinition.apiextensions.k8s.io/cdpipelineruns.devops.cloud.ibm.com created
serviceaccount/cd-tekton-agent-controller-manager created
role.rbac.authorization.k8s.io/cd-tekton-agent-leader-election-role created
clusterrole.rbac.authorization.k8s.io/cd-tekton-agent-manager-role created
rolebinding.rbac.authorization.k8s.io/cd-tekton-agent-leader-election-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/cd-tekton-agent-manager-rolebinding created
configmap/cd-tekton-agent-manager-config created
deployment.apps/cd-tekton-agent-controller-manager created
configmap/config-defaults created
$

tekton-pipelines ネームスペースが作成されてその中に private worker の定義が稼働しています。
(Kubernetes のダッシュボードを確認)

図10.png


自分のクラスターにおいて新規ワーカーを登録します。

$ kubectl apply --filename "https://private-worker-service.jp-tok.devops.cloud.ibm.com/install/worker?serviceId=ServiceId-47f3ad3b-33d4-4d19-a202-9afe817a9368&apikey=xI2PzGhvVLqiRhA_zYY1Q4x2JAlNMchPuk88ykNRnSkA&name=test-worker"
secret/test-worker-auth created
workeragent.devops.cloud.ibm.com/test-worker created
$

ワーカーエージェントの定義が設定されました。

ワーカーがクラスター上に作成されたことを確認します。

$ kubectl get workeragent
NAME          SERVICEID                                        AGENT   REGISTERED   VERSION   AUTH   CONSTRAINED   PAUSED
test-worker   ServiceId-47xxxx3b-33d4-4d19-axxx-9afexxxxx368   OK      Succeeded    OK        OK                   false
$

少し待って、Delivery pipeline プライベート・ワーカーの登録済みワーカー・プールに対象が出てくるのを確認します。

図11.png

対象のワーカー・ノードが Delivery Pipeline のプライベート・ワーカーとして登録されました。

なお、導入した worker agent は IBM Cloud のアップデートにより更新が必要になりますのでご注意ください。

更新作業は以下で確認しました。


以上です。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1