Deployments on OCI OKE from OCIR

Imagine a scenario like this. You need to deploy an application on your Kubernetes cluster from local repository. However you plan to make use of an image from publicly available repository. This blog will explain this in regard to Oracle Cloud.

Step 1: Download Image from public

In this example, I’m using ‘nginx’ application. You’ll need to download this image to your local environment first, as shown in Figure1.

Figure 1: Download nginx

Then, we need to make sure the image is received properly with the ‘docker images’ command.

Figure 2: Check Images

Step 2: Create Repository

We need to create our internal repository next. In Oracle Cloud Infrastructure, its called ‘Oracle Cloud Infrastructure Registry’ or OCIR which you can find under ‘Developer Services’.

Figure 3: Create Repository

Figure 4 shows the repository once it’s successfully created.

Figure 4: OCIR Repository

Step 3: Prepare Auth Token

Then, we need to authenticate the tenant user account to OCIR. For this, you need to create an ‘Auth token’ as below.

Figure 5: Locate & Create Auth Token

Once the token is generated, you will need to copy and store it as it will not show the value again.

Figure 6: Generated Auth Token

Step 4: Push Image to OCIR

Now, we can prepare the credentials required to log in to OCIR as below.

username: <namespace>/<email or username>

password: auth token generated above

Figure 7 below shows the process of login to the OCIR. Here, ‘sin’ represent the OCI region (In this case, Singapore).

“docker login <region code>.ocir.io”

Figure 7: Login to OCIR

Next, we need to ‘tag’ the image with the preferred identification as in Figure 8.

Figure 8: Tagging image

Finally we can push the image to the repository with ‘docker push’ command.

Figure 9: Pushing Image

We can visually verify the image by login into the console. There, we can find the full path to the image as well.

Figure 10: Verifying Image

Step 5: Deploy on OKE by Pulling Image from OCIR

Once the image push is successful and full path is copied we can use it for a deployments. In the below example, nginx application to be deployed on OKE by pullling the image from OCIR.

Figure 11: nginx.yaml

References

https://docs.oracle.com/en-us/iaas/Content/Registry/Tasks/registrypullingimagesfromocir.htm?source=post_page—–cee2b60ec071——————————–

https://www.oracle.com/webfolder/technetwork/tutorials/obe/oci/registry/index.html?source=post_page—–cee2b60ec071——————————–

https://docs.oracle.com/en-us/iaas/Content/ContEng/Tasks/contengusingclusterautoscaler.htm?source=post_page—–cee2b60ec071——————————–

1 thought on “Deployments on OCI OKE from OCIR”

Comments are closed.