Pushing a Helm chart
Amazon ECR supports pushing Open Container Initiative (OCI) artifacts to your repositories. To display this functionality, use the following steps to push a Helm chart to Amazon ECR.
For more information about using your Amazon ECR hosted Helm charts with Amazon EKS, see Installing a Helm chart hosted on Amazon ECR with Amazon EKS.
To push a Helm chart to an Amazon ECR repository
-
Install the Helm client version 3. For more information, see Installing Helm
. -
Enable OCI support in the Helm 3 client.
export HELM_EXPERIMENTAL_OCI=1
-
Create a repository to store your Helm chart. For more information, see Creating a repository.
aws ecr create-repository \ --repository-name
artifact-test
\ --regionus-west-2
-
Authenticate your Helm client to the Amazon ECR registry to which you intend to push your Helm chart. Authentication tokens must be obtained for each registry used, and the tokens are valid for 12 hours. For more information, see Private registry authentication.
aws ecr get-login-password \ --region
us-west-2
| helm registry login \ --username AWS \ --password-stdinaws_account_id
.dkr.ecr.region
.amazonaws.com -
Use the following steps to create a test Helm chart. For more information, see Helm Docs - Getting Started
. -
Create a directory named
helm-tutorial
to work in.mkdir
helm-tutorial
cdhelm-tutorial
-
Create a Helm chart named
mychart
and clear the contents of thetemplates
directory.helm create
mychart
rm -rf ./mychart
/templates/* -
Create a ConfigMap in the
templates
folder.cd
mychart
/templates cat <<EOF > configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name:mychart
-configmap data: myvalue: "Hello World" EOF
-
-
Save the chart locally and create an alias for the chart with your registry URI.
cd .. helm chart save .
mychart
helm chart save .aws_account_id
.dkr.ecr.us-west-2
.amazonaws.com/artifact-test
:mychart
-
Identify the Helm chart to push. Run the helm chart list command to list the Helm charts on your system.
helm chart list
The output should look similar to this:
REF NAME VERSION DIGEST SIZE CREATED
aws_account_id
.dkr.ecr.us-west-2
.amazonaws.com/artifact-tes.. mychart 0.1.0 30e0a03 3.6 KiB 14 secondsmychart
mychart 0.1.0 ba3e62a 3.6 KiB About a minute -
Push the Helm chart using the helm chart push command:
helm chart push
/aws_account_id
.dkr.ecr.region
.amazonaws.comartifact-test:mychart
-
Describe your Helm chart.
aws ecr describe-images \ --repository-name
artifact-test
\ --regionus-west-2
In the output, verify that the
artifactMediaType
parameter indicates the proper artifact type.{ "imageDetails": [ { "registryId": "
aws_account_id
", "repositoryName": "artifact-test", "imageDigest": "sha256:f23ab9dc0fda33175e465bd694a5f4cade93eaf62715fa9390d9fEXAMPLE", "imageTags": [ "mychart" ], "imageSizeInBytes": 3714, "imagePushedAt": 1597433021.0, "imageManifestMediaType": "application/vnd.oci.image.manifest.v1+json", "artifactMediaType": "application/vnd.cncf.helm.config.v1+json" } ] }