0
2

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 1 year has passed since last update.

Helm チャートを Amazon ECR リポジトリにプッシュしてインストールする

Last updated at Posted at 2023-11-08

Helm Chart を ECR に push する

# 現在の Helm のバージョンを確認
helm version --short | cut -d + -f 1
    v3.13.1

# Helm Chart を作成
helm create mychart
    Creating mychart

# templates ディレクトリ内のファイルを削除
rm -rf mychart/templates/*

# 次のファイルを作成(configmap.yamlの内容は後述参照)
mychart/templates/configmap.yaml

# Helm Chart をパッケージ化
helm package mychart
Successfully packaged chart and saved it to: ./mychart-0.1.0.tgz

# Helm Chartを格納するリポジトリを作成
aws ecr create-repository \
     --repository-name mychart

# ECR に Helm クライアントを認証します。
# 認証トークンは、使用するレジストリごとに取得する必要があり、トークンは 12 時間有効
aws ecr get-login-password \
     --region ap-northeast-1 | helm registry login \
     --username AWS \
     --password-stdin 123456789012.dkr.ecr.ap-northeast-1.amazonaws.com
    Login Succeeded

# Helm チャートを push
helm push mychart-0.1.0.tgz oci://123456789012.dkr.ecr.ap-northeast-1.amazonaws.com/
    Pushed: 123456789012.dkr.ecr.ap-northeast-1.amazonaws.com/mychart:0.1.0
    Digest: sha256:d05239c89412bcf9764a434e6e471f553b874973fc1a1235cbcc88XXXXXXXXXX

# ECR に artifactMediaType が Helm Chart で作成されたことを確認
aws ecr describe-images \
     --repository-name mychart
{
    "imageDetails": [
        {
            "registryId": "123456789012",
            "repositoryName": "mychart",
            "imageDigest": "sha256:d05239c89412bcf9764a434e6e471f553b874973fc1a1235cbcc88XXXXXXXXXX",
            "imageTags": [
                "0.1.0"
            ],
            "imageSizeInBytes": 1753,
            "imagePushedAt": "2023-11-08T19:35:10+09:00",
            "imageManifestMediaType": "application/vnd.oci.image.manifest.v1+json",
            "artifactMediaType": "application/vnd.cncf.helm.config.v1+json",
            "lastRecordedPullTime": "2023-11-08T19:35:11.252000+09:00"
        }
    ]
}
configmap.yaml
apiVersion: v1
kind: ConfigMap

metadata:
  name: mychart-configmap

data:
  myvalue: "Hello World"

EKS を使用して ECR でホストされる Helm チャートをインストールする

# ECR の Helm Chart をインストール
helm install mychart oci://123456789012.dkr.ecr.ap-northeast-1.amazonaws.com/mychart --version 0.1.0
    Pulled: 123456789012.dkr.ecr.ap-northeast-1.amazonaws.com/mychart:0.1.0
    Digest: sha256:d05239c89412bcf9764a434e6e471f553b874973fc1a1235cbcc88XXXXXXXXXX
    NAME: mychart
    LAST DEPLOYED: Wed Nov  8 19:57:52 2023
    NAMESPACE: default
    STATUS: deployed
    REVISION: 1
    TEST SUITE: None

# Helm Chart のインストール確認
helm list -n default
    NAME    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
    mychart default         1               2023-11-08 19:57:52.338054 +0900 JST    deployed        mychart-0.1.0   1.16.0    

# ConfigMap を確認
kubectl get configmap -o wide
    NAME                DATA   AGE
    mychart-configmap   1      5m16s

Amazon EKS チャート

参考

0
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?