We are using AWS ecr for storing our application images and the AWS ecr support of Open Container Initiative (OCI) artifacts for Helm has greatly boosted the development effort on our Helm charts. This article will show you how to create, push and pull helm chart into the AWS ecr repository. Also will showcase if you face any error related to ocr what necessary steps you need to take in order to resolve it.
For more information on documentation on this feature, you can visit on AWS blog https://aws.amazon.com/blogs/containers/oci-artifact-support-in-amazon-ecr/
The Open Container Initiative (OCI), an open-source community for creating open standards around containers. This is a community standard for how image artifacts should look. For more information on OCI, please visit https://opencontainers.org/
Keep in mind that Helm 3 was slightly different prior to the release of Helm 3.7.0 and the major changes with AWS support required to upgrade the Helm on 3.7.0 or above.
So let us begin by creating a simple helm chart:-
helm create example-hello-world
helm chart save example-hello-world $REPO_CHART
Next, log into Amazon ECR with:
aws ecr get-login-password --region aa-east-0 | helm registry login --username AWS --password-stdin account_id.dkr.ecr.aa-east-0.amazonaws.com
Create Helm tgz package for upload into ECR.
Optionally you can verify the content of the Helm chart by running the command below:
Optinally the next command runs a series of tests to verify that the chart is well-formed:
helm lint example-hello-world-a.a.a.tgz
You can maintain the image versions using the below command:
helm package example-hello-world --version "a.a.a" helm package example-hello-world --version "b.b.b"
Currently OCI support is considered experimental and therefore set HELM_EXPERIMENTAL_OCI using the below command:
In case you have not created the repo in ecr use the below command to store your Helm chart. The name of your repository should match the name you use in the Helm chart.
aws ecr create-repository --repository-name example-hello-world --region us-east-1
Now let us package our chart with a specific version
helm package example-hello-world --version "a.a.a"
And finally publish the Helm chart to ECR, note that the push command can only be used against .tgz files and must not contain basename or tag. Otherwise, an error will be produced during the helm push operation.
helm push example-hello-world-1.1.1.tgz oci://account-id.dkr.ecr.us-east-1.amazonaws.com
Additionally, to deploy your helm chart use the below command
helm install example-hello-world ./example-hello-world --namespace mynamespace --version 1.1.1
Now In case, you want to modify the default values of .yaml and, would like to test your chart with new values you need to first pull the chart locally.
helm pull oci://accountid.dkr.ecr.us-east-1.amazonaws.com/example-hello-world --version 1.1.1
If you see – Error: path “. /example-hello-world” not found, you have to unzip the chart source using the command below:-
tar -xvzf example-hello-world-1.1.1.tgz
Now if you are done with editing the values.yaml, use below command to test chart
helm install example-hello-world ./example-hello-world --namespace mynamespace -f values.yaml
Other command that you might be interested in:-
$helm show chart example-hello-world apiVersion: v2 appVersion: 1.1.1 description: My decription home: https://www.aaaaaaa.org/ icon: https://wiki.bbbbbbb.org/images/3/30/ssss_logo.3colors.120x120.png keywords: - aaa - bbb - ccc - ddd maintainers: - email: email@example.com name: example name: example-hello-world sources: - https://github.com/mukeshfromharyana/helm-charts type: application version: a.a.a
Helm template will show you the templates being used in this chart
$helm template oepgadmin
The mission of the Open Container Initiative (OCI) is to promote a set of common, minimal, open standards and specifications around container technology. Therefore Happy Helming…