Deploying to a Kubernetes Cluster
Create a pipeline to deploy artifacts to a Kubernetes Engine (OKE) cluster.
Before you add the stage, you must have a deployment pipeline, Kubernetes cluster environment to deploy to, and artifacts. Artifacts can be defined inline or located in the Artifact Registry.
DevOps supports deployment of helm charts to OKE cluster. The charts must be located in the OCI Container Registry repository. See Adding a Helm Chart.
To deploy to an OKE cluster using the Blue-Green release strategy, see Blue-Green OKE Deployment and using the Canary strategy, see Canary OKE Deployment.
Each service in Oracle Cloud Infrastructure (OCI) integrates with Identity and Access Management (IAM) for authentication and authorization. To grant users permission to access the DevOps deployment pipelines and other resources, you have to create dynamic groups and IAM policies.
For creating dynamic groups and policies for deployment pipelines, see Deployment Pipeline Policies. For more details, see DevOps IAM Policies.
For accessing DevOps using the Oracle Cloud Console, REST API, and CLI, see Accessing DevOps.
- Open the navigation menu and click Developer Services. Under DevOps, click Projects.
- Select a project, and a deployment pipeline.
- To add a stage to the pipeline, click the + icon and select Add stage.
- For stage type, select Deploy - OKE, and then click Next.
- Enter a name and description for the stage. Adding a description is optional.
- For Environment, select an existing cluster environment.
- Click Select Artifact, and then select one or more artifact resources from your
DevOps project.
The DevOps service performs a Kubernetes server-side apply of the Kubernetes manifest artifacts in the order that they appear in the Console. You can also remove artifacts to select another one or reorder the artifacts list. Removing an artifact in the pipeline stage does not delete the artifact resource from your project. For more information on Kubernetes server-side apply, see Server-Side Apply.
- (Optional) To override the default environment namespace, enter value for Override Kubernetes namespace.
- To automatically roll back to the last successful release version if the validation fails, select Yes. For more information, see Rolling Back a Deployment.
- (Optional) To add tags to the pipeline, click Show tagging options. Tagging is a
metadata system that lets you organize and track the resources in your tenancy.
If you have permissions to create a resource, you also have permissions to add free-form tags to it.
To add a defined tag, you must have permissions to use the tag namespace.
For more information, see Resource Tags.
- To add the stage to the pipeline, click Add.
A stage preview provides a snapshot of the configuration.
Add more stages sequentially or in parallel to the pipeline, as needed. To deploy the build output to the target environment, run the deployment pipeline. To automatically trigger a deployment from the build pipeline, you can add a Trigger Deployment stage to the build pipeline.
To create a Kubernetes cluster stage for the pipeline, run the
create-deploy-oke-stage
command:oci devops deploy-stage create-deploy-oke-stage
Required parameters for the
create-deploy-oke-stage
command:--kubernetes-manifest-artifact-ids
--oke-cluster-environment-id
--pipeline-id
--stage-predecessor-collection
To get all the commands for
deploy-stage
:oci devops deploy-pipeline -h
oci devops deploy-stage -h
To get help for the
create-deploy-oke-stage
command:oci devops deploy-stage create-deploy-oke-stage -h
To create a Kubernetes cluster stage for the pipeline, use the
CreateDeployStage
operation. For thedeployStageType
attribute, specify theOKE_DEPLOYMENT
andRUN_OKE_JOB
values.