0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【ACR Push編】 Confluent Platform を Azure Kubernetes Service (AKS) で動かしてみました

Last updated at Posted at 2021-09-09

概要

この記事 から始まる3つのステップで稼働させた一連のコンテナアプリを定義した docker-compose.yml を kcompose convert することにより、Kuberbetesのマニフェストを作成し、それを元にAKSで同様に稼働できることを確認します。
image.png

以下の2つのステップで上記内容を順次説明します。
STEP-1.コンテナイメージを ACR にプッシュする
STEP-2.AKSでコンテナアプリを稼働させる

今回の STEP-1 では、一連のローカルDockerコンテナアプリのイメージを Azure Container Registry(ACR)にプッシュするまでの手順を説明します。
image.png

ローカル環境

macOS Big Sur 11.3
python 3.8.3

事前準備

この記事 にある「ACR(Azure Container Registry)のレジストリ作成」を完了していること。


コンテナイメージのプッシュ

Docker環境でのコンテナIDの取得

事前に「docker-compose stop」の実行しておきます。

$ docker ps -a

CONTAINER ID   IMAGE                                             COMMAND                  CREATED       STATUS                        PORTS     NAMES
b244ceea916e   confluentinc/cp-enterprise-control-center:6.0.0   "/etc/confluent/dock…"   2 hours ago   Exited (143) 37 seconds ago             control-center
05b3be2d1261   confluentinc/cp-ksqldb-cli:6.0.0                  "/bin/sh"                2 hours ago   Exited (0) 38 seconds ago               ksqldb-cli
bac53178ec6a   confluentinc/cp-ksqldb-server:6.0.0               "/etc/confluent/dock…"   2 hours ago   Exited (143) 34 seconds ago             ksqldb-server
4463b1c854a3   cp-connect-base:latest                            "/etc/confluent/dock…"   2 hours ago   Exited (143) 32 seconds ago             connect
93339b96092d   confluentinc/cp-schema-registry:6.0.0             "/etc/confluent/dock…"   2 hours ago   Exited (143) 30 seconds ago             schema-registry
94f49390c759   confluentinc/cp-server:6.0.0                      "/etc/confluent/dock…"   2 hours ago   Exited (137) 18 seconds ago             broker
d74cf86680bb   grafana/grafana                                   "/run.sh"                2 hours ago   Exited (0) 38 seconds ago               grafana
21167621d7e3   confluentinc/cp-zookeeper:6.0.0                   "/etc/confluent/dock…"   2 hours ago   Exited (143) 15 seconds ago             zookeeper
5075946da389   rabbitmq:3.8.17-management                        "docker-entrypoint.s…"   2 hours ago   Exited (0) 32 seconds ago               rabbitmq
aaaf61e234c6   influxdb:1.8.6                                    "/entrypoint.sh infl…"   2 hours ago   Exited (0) 36 seconds ago               influxdb

ACRログインサーバーアドレスの取得

$ ACR_LOGIN_SERVER=$(az acr list --resource-group $ACR_RES_GROUP --query "[].{acrLoginServer:loginServer}" --output tsv)

$ echo $ACR_LOGIN_SERVER
acr0ituru.azurecr.io

ACR ログインサーバアドレスでのコミット

$ docker commit 5075946da389 $ACR_LOGIN_SERVER/rabbitmq:3.8.17
$ docker commit d74cf86680bb $ACR_LOGIN_SERVER/grafana:8.0.6
$ docker commit aaaf61e234c6 $ACR_LOGIN_SERVER/influxdb:1.8.6
$ docker commit 4463b1c854a3 $ACR_LOGIN_SERVER/cp-connect-base:6.0.0
$ docker commit 94f49390c759 $ACR_LOGIN_SERVER/cp-server:6.0.0
$ docker commit b244ceea916e $ACR_LOGIN_SERVER/cp-control-center:6.0.0
$ docker commit 21167621d7e3 $ACR_LOGIN_SERVER/cp-zookeeper:6.0.0
$ docker commit bac53178ec6a $ACR_LOGIN_SERVER/cp-ksqldb-server:6.0.0
$ docker commit 93339b96092d $ACR_LOGIN_SERVER/cp-schema-registry:6.0.0


$ docker images | grep $ACR_LOGIN_SERVER

acr0ituru.azurecr.io/cp-connect-base                6.0.0               ab7c3ded2793   7 days ago   1.66GB
acr0ituru.azurecr.io/grafana                        8.0.6               7a91cc35d504   7 days ago   212MB
acr0ituru.azurecr.io/cp-schema-registry             6.0.0               651bacf2cb5c   7 days ago   1.33GB
acr0ituru.azurecr.io/cp-ksqldb-server               6.0.0               0987ef6c7751   7 days ago   1.06GB
acr0ituru.azurecr.io/cp-zookeeper                   6.0.0               23253e3dbc5c   7 days ago   721MB
acr0ituru.azurecr.io/cp-control-center              6.0.0               99971d18b95d   7 days ago   995MB
acr0ituru.azurecr.io/cp-server                      6.0.0               1a00ecce9821   7 days ago   1.24GB
acr0ituru.azurecr.io/influxdb                       1.8.6               2ff29d3611c4   7 days ago   308MB
acr0ituru.azurecr.io/rabbitmq                       3.8.17              e99b3b21637f   7 days ago   324MB

ACRへのログイン

$ az acr login --name $ACR_NAME
Login Succeeded

イメージをACRにプッシュ

$ docker push $ACR_LOGIN_SERVER/rabbitmq:3.8.17
$ docker push $ACR_LOGIN_SERVER/grafana:8.0.6
$ docker push $ACR_LOGIN_SERVER/influxdb:1.8.6
$ docker push $ACR_LOGIN_SERVER/cp-connect-base:6.0.0
$ docker push $ACR_LOGIN_SERVER/cp-server:6.0.0
$ docker push $ACR_LOGIN_SERVER/cp-control-center:6.0.0
$ docker push $ACR_LOGIN_SERVER/cp-zookeeper:6.0.0
$ docker push $ACR_LOGIN_SERVER/cp-ksqldb-server:6.0.0
$ docker push $ACR_LOGIN_SERVER/cp-schema-registry:6.0.0

イメージ一覧の表示

$ az acr repository list --name $ACR_NAME --output table

Result
----------------------------
cp-connect-base
cp-control-center
cp-ksqldb-server
cp-schema-registry
cp-server
cp-zookeeper
grafana
influxdb
iotdatagen
rabbitmq

まとめ

これで、必要なDockerイメージが全てACRに登録されました。


付録

イメージ詳細の確認

$ az acr repository show --name $ACR_NAME --repository cp-zookeeper

{
  "changeableAttributes": {
    "deleteEnabled": true,
    "listEnabled": true,
    "readEnabled": true,
    "teleportEnabled": false,
    "writeEnabled": true
  },
  "createdTime": "2021-07-30T05:14:02.4768303Z",
  "imageName": "cp-zookeeper",
  "lastUpdateTime": "2021-07-30T05:14:02.5721169Z",
  "manifestCount": 1,
  "registry": "acr0ituru.azurecr.io",
  "tagCount": 1
}

イメージタグの確認

az acr repository show-tags -n $ACR_NAME --repository cp-zookeeper --output table

Result
--------
6.0.0

イメージの削除

$ az acr repository delete --name $ACR_NAME --repository cp-zookeeper
Are you sure you want to delete the repository 'cp-zookeeper' and all images under it? (y/n): y

レジストリ サイズの管理

$ az acr show-usage --resource-group $ACR_RES_GROUP --name $ACR_NAME --output table

NAME      LIMIT         CURRENT VALUE    UNIT
--------  ------------  ---------------  ------
Size      107374182400  3043966295       Bytes
Webhooks  10            0                Count
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?