Using the GitHub Container Registry with Azure Kubernetes Service (AKS)
IT Management

Using the GitHub Container Registry with Azure Kubernetes Service (AKS)


Recently I wished to attempt the GitHub container pc registry as an option for Azure Container Pc Registry. Because lots of things are moving towards GitHub this appeared an excellent concept.

The strategy I wished to perform was as follows:
* Develop a Docker Container with GitHub Actions
* Press a Docker Container to the GitHub Container Pc Registry
* Pull the Container In Your Area
* Pull the container on Azure Kubernetes Service (AKS)

So this is what I did, and the actions I followed are recorded listed below.

Develop and Press a Docker Container with GitHub Actions

This was rather simple. Initially I produced this repository where I produced a really easy Dockerfile (Based upon this amazing repo After that I included a GitHub action workflow that constructs and presses this to the GitHub pc registry.

When browsing to the Actions tab on the repo, you can choose the starter workflow “Release Docker Container”, to get you began.

When you select to establish this workflow, the very first thing you require to do is alter the IMAGE_NAME After that you are practically done, other than that you require to pay attention to the following area.

Due To The Fact That the GitHub Container Windows registry is still in Beta, you can not utilize the basic Github Tricks yet. To access the GitHub Container Windows registry you require to develop an Individual Gain access to Token with consents to press and pull plans and after that include this as a trick to your repository.

To develop an Individual Gain access to Token, browse to your profile settings and develop one in the Designer Settings area. Follow this guide on Github Docs to develop a PAT. Make certain you inspect the compose: plans, read: plans and erase: plans approval.

When you produced the PAT, make certain you wait on your clipboard. Browse to your repository settings, and include a secret called CR_PAT and include the PAT you minimized the clipboard.

Back in your GitHub Actions, you can now begin the Action to develop and press the container.

When your develop finished succesfully, you can browse to the plans area of your account, to see the Docker image. E.g.

Pull the Container In Your Area

Excellent! We handled to press a container to Github Container Pc Registry. Now we require to utilize the image. In your area it works rather easy. You require to login to the Github Container Pc Registry with the exact same PAT as you produced in the Github Tricks. Then perform the command listed below and you are great to go.

echo << YOUR_PAT> >|docker login ghcr.io -u USERNAME-- password-stdin.
docker pull ghcr.io/<< your_repository>>/<< your_imagename>>.

Take a look at this link for more information on this

Configure AKS to utilize GitHub Container Windows registry

Azure Kubernetes Service (AKS) deals with all Container Registries that follow the Docker pc registry user interface. So, it likewise deal with Github. Presuming that you currently have a AKS running, you require to include a Pull Trick for the Github Container Pc Registry.

From the command line you can perform the following command

 kubectl develop secret docker-registry pullsecret -- docker-server =

With that you include a trick to the AKS cluster. In your release, you require to describe this pullsecret to get the containers. Take a look at the example killerapp.deploy.yml and killerapp.service.yml files in my Git repository.

When you run kubectl use -f killerapp-deploy. yml the pod will be released pulling the image from the Github Container Pc Registry!

Hope this assists!


Source link