Deploying to OKE from GitLab CI/CD

March 14, 2024 | 3 minute read
Adina Nicolescu
Senior Cloud Engineer
Guido Ferreyra
Principal Cloud Architect
Text Size 100%:

We often hear from customers asking whether they can integrate their existing third-party pipeline solutions with the Oracle Container Engine for Kubernetes (OKE).

In the domain of deploying applications to OKE, GitLab continuous integration and delivery (CI/CD) frequently emerges as a compelling colution for customers. The flexibility and robust features of GitLab CI/CD make it a viable choice, offering a seamless integration pathway for your Kubernetes deployment needs.

One of the notable use cases for using GitLab CI/CD for OKE deployments lies in its versatility. Whether you are working on a small-scale project or a complex enterprise application, GitLab CI/CD provides a unified platform for continuous integration and continuous deployment, eliminating the need to bundle disparate DevOps tools. This consolidation simplifies your workflow, reducing complexity and ensuring a more streamlined development process.
 

GitLab CI/CD for OKE

 

Diagram GitLab CICD - OKE

The benefit of adopting GitLab CI/CD for OKE deployments is that you can use your existing pipelines and repos. For this reason, you can spend more time familiarizing yourself with the OKE service, without the worry of having to interpret a new DevOps tool chain.

When delving into the mechanics of GitLab CI/CD, understanding GitLab executors is crucial. These virtual environments are where your CI/CD jobs run. For example, the Shell executor is commonly used for its simplicity and flexibility because it enables you to execute commands directly on the runner's host machine, making it an efficient choice for tasks related to OKE deployments.

In the context of GitLab CI/CD for OKE, the Shell executor gives you the flexibility to define custom deployment scripts and commands, tailoring the deployment process to the specific needs of your project. This level of customization ensures that you have full control over the deployment steps, optimizing them according to your application's requirements.

At the heart of GitLab CI/CD configuration is the .gitlab-ci.yaml file. This YAML file serves as the blueprint for your CI/CD pipeline, defining the stages, jobs, and associated configurations. In the context of OKE deployments, this file becomes the orchestrator, guiding the CI/CD process from source code to deployment on the OKE cluster. Understanding and crafting this file allows you to fine-tune your deployment pipeline, ensuring a reliable and efficient process tailored to your specific use case.

Authentication to OCI 

You can authenticate from a GitLab runner to your Oracle Cloud Infrastructure (OCI) tenancy OKE cluster using one of the following methods:

  • Using a Kubernetes ServiceAccount (recommended)
  • Using the OCI CLI - Refer to the access cluster steps for an OKE cluster

This approach also works with other CI/CD solutions.

Summary

For those just beginning to explore the possibilities in Oracle Cloud Infrastructure and OKE, GitLab-OKE integration can be an entry point into the world of cloud-native development and deployment. Because we're open for DevOps solutions and we understand that developers are comfortable with an array of third-party CI/CD solutions, we want to allow them to use those tools with services from our CloudNative portfolio.

For detailed steps on implementation, you can refer to our tutorial, Deploy to OCI Container Engine for Kubernetes from Gitlab CI/CD.

Adina Nicolescu

Senior Cloud Engineer

Guido Ferreyra

Principal Cloud Architect


Previous Post

Oracle and Microsoft bring Oracle Database@Azure to Europe

Ravi Turlapati | 3 min read

Next Post


Oracle Access Governance optimizes identity orchestration and enables unlimited integrations with generic connectors

Pavana Jain | 4 min read