How to Use GitLab Container Registry in Amazon EKS?

GitLab Container Registry


In today’s fast-paced software development landscape, leveraging containerization technologies like Docker and Kubernetes has become indispensable for building scalable and flexible applications. Amazon Elastic Kubernetes Service (EKS) simplifies deploying, managing, and scaling containerized applications on AWS. GitLab Container Registry offers an integrated solution for storing and managing Docker container images within the GitLab ecosystem.

In this blog post, we’ll explore how to effectively utilize GitLab Container Registry with Amazon EKS. We’ll provide a step-by-step guide on integration and highlight key takeaways.

Background or Context on GitLab Container Registry

GitLab Container Registry is a feature of GitLab that allows users to store Docker container images within their GitLab projects. It provides a centralized repository for managing container images, streamlining the development and deployment process. On the other hand, Amazon EKS simplifies Kubernetes deployment by handling the underlying infrastructure, enabling developers to focus on building and managing their applications.

Steps to set up the GitLab Container Registry credentials

GitLab Container Registry

A crucial aspect of the deployment pipeline involved leveraging the GitLab Container Registry. However, this seemingly straightforward component posed unexpected challenges. Issues ranged from authentication problems to image storage constraints, requiring a deep dive into Docker and GitLab configurations. Patience and perseverance were key as I tackled each issue methodically, ultimately ensuring a smooth flow in the containerization process.


Steps to apply

Pulling images directly from the GitLab Container Registry to Kubectl was difficult. The solution required a detailed process:

  1. Generate Base64 Encoded Credentials: The first step was to generate base64 encoded credentials using the following command:

    echo -n "<GitLab_User_Name>:<GitLab_Access_Token>" | base64

  2. Create creds.json File: Next, I created a creds.json file with the encoded credentials(replace the “Step-1_Output_Paste_Here” keyword with the step-1 output):

    "auths": {
    "": {
    "auth": "<Step-1_Output_Paste_Here>"

  3. Base64 Encode creds.json: I then encoded the creds.json file using the following command:

    cat creds.json | base64

  4. Update Kubernetes Secret using a registry-credentials.yml file: Using the encoded credentials, I created a Kubernetes secret named registry-credentials to securely store the authentication information(replace the “YOUR_BASE64_KEY” keyword with the step-3 output):

    apiVersion: v1
    kind: Secret
    name: registry-credentials
    namespace: default
    .dockerconfigjson: <YOUR_BASE64_KEY>

  5. Use registry-credentials in your deployment.yml file: Finally, I updated the deployment configuration to specify the registry-credentials secret for image pulling:

    apiVersion: apps/v1
    kind: Deployment
    name: <app-name>
    replicas: 1
    app: <app-name>
    app: <app-name>
    - name: <app-name>
    image: <container-registry-image-path>
    imagePullPolicy: Always
    - containerPort: 80
    - name: registry-credentials

    This step-by-step process ensured secure and authenticated access to the GitLab Container Registry, resolving the image-pulling challenges.

Case-Study on GitLab Container Registry

Consider a scenario where a software development team is building a microservices-based application deployed on Amazon EKS. By leveraging GitLab Container Registry, they can streamline their development workflow and ensure consistency across different environments. The team utilizes GitLab CI/CD pipelines to automate the building and testing of Docker images, with the resulting images stored in GitLab Container Registry.

These images are then seamlessly deployed to Amazon EKS, where they power the various microservices comprising the application. Through this approach, the team achieves faster iteration cycles, improved reliability, and easier collaboration.


In conclusion, integrating GitLab Container Registry with Amazon EKS offers numerous benefits for developers and DevOps teams. By centralizing container image management within the GitLab ecosystem and leveraging the power of Amazon EKS for Kubernetes deployment, organizations can streamline their development workflow, improve collaboration, and accelerate time-to-market.

By following the steps outlined in this blog post and embracing a container-native approach, teams can unlock the full potential of modern application development on AWS.

Thank you for Reading !! 🙌🏻😁📃, see you in the next blog.🤘

I hope this article proves beneficial to you. In case of any doubts or suggestions, feel free to mention them in the comment section below or directly contact us.

The end ✌🏻