You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Building and Deploying to OKE with Azure DevOps
39
+
# Building and Deploying to OKE with Azure DevOps
43
40
44
-
There are two ways (at least) to build and deploy to OKE from Azure DevOps:
41
+
There are two ways (at least) to build and deploy to Oracle Container Registry (OCIR) and Oracle Kubernetes Engine (OKE) from Azure DevOps:
45
42
<ul>
46
43
<li>Use OCI VM as Azure parallel job self-hosted build agent that will run as <code>instance-principal</code> and hence no OCI credentials are needed to be shared with Azure DevOps. Here <code>kubectl</code> and OCI native tooling like <code>oci cli</code> can be used in pipelines.</li>
47
44
<br>
48
-
<li>Use Azure DevOps native <code>tasks</code> that can run as either Azure-hosted or as self-hosted Azure parallel jobs. Credentials will be stored to Azure DevOps.</li>
45
+
<li>Use Azure DevOps native <code>tasks</code> that can run as either Azure-hosted or as self-hosted Azure parallel jobs to deploy to OCIR and OKE. Credentials will be stored to Azure DevOps.</li>
49
46
</ul>
50
47
51
48
<p>
52
-
For this example I've used the second option. I'm also using a self-hosted agent/runner on OCI but that's just because I can use the <code>always-free</code> VM instance for it as part of the default OCI subscription and I don't have any Azure-hosted agents available in my Azure subscription. Technically that does not matter since the agent is a vanilla Oracle Linux VM instance and does not contain any customizations whatsover to do the pipeline work (it could however, but it does not).
49
+
For this example I've used the second option. I'm also using a self-hosted agent/runner on OCI but that's just because I can use the <code>always-free</code> VM instance for it as part of the default OCI subscription and I don't have any Azure-hosted agents available in my Azure subscription. Technically that does not matter since the agent is a vanilla Oracle Linux VM instance and does not contain any customizations whatsover to do the pipeline work (it could however, but it does not).
50
+
51
+
Reviewed: 29.10.2024
52
+
53
+
# When to use this asset?
54
+
55
+
Anyone who wants to do CI/CD from Azure DevOps to deploy and run containers on Oracle Kubernetes Engine (OKE) using Azure DevOps native tasks.
@@ -60,7 +68,7 @@ To make this build and deploy to OKE to work is not a big task. First copy the f
60
68
Before building the Docker image repo needs to be created under the desired <code>compartment</code>. This can be easily done using OCI Cloud UI. Name the repository as <b><i>Azure-test</i></b>, for example.
61
69
62
70
<p>
63
-
Then modify the <code>deployment.yaml</code> <ahref="https://github.com/oracle-devrel/technology-engineering/tree/main/app-dev/devops-and-containers/devops/azure-devops-oke/deployment.yaml#L19">line 19</a> by replacing the <TENANCY_NAMESPACE> with yours and if you gave another name for the OCIR repo then modify also that here, too. Modify also the <code>region</code> if using some other OCI region than <b><i>fra.ocir.io</i></b>.
71
+
Then modify the <code>deployment.yaml</code> <ahref="https://github.com/oracle-devrel/technology-engineering/tree/main/app-dev/devops-and-containers/devops/azure-devops-oke/files/deployment.yaml#L19">line 19</a> by replacing the <TENANCY_NAMESPACE> with yours and if you gave another name for the OCIR repo then modify also that here, too. Modify also the <code>region</code> if using some other OCI region than <b><i>fra.ocir.io</i></b>.
64
72
65
73
<p>
66
74
To be able to do <code>Docker login</code> to the repo create <code>auth token</code> for your OCI user unless you already have one.
@@ -74,7 +82,7 @@ Once the OKE cluster is up and running with <code>kubectl</code> access setup th
Name the secret <b><i>oke-kubeconfig-azure-token</i></b> as in <code>azure-token.yaml</code> <ahref="https://github.com/oracle-devrel/technology-engineering/tree/main/app-dev/devops-and-containers/devops/azure-devops-oke/azure-token.yaml#L4"target="_NEW">line 4</a>.
85
+
Name the secret <b><i>oke-kubeconfig-azure-token</i></b> as in <code>azure-token.yaml</code> <ahref="https://github.com/oracle-devrel/technology-engineering/blob/repo-review-fixed/app-dev/devops-and-containers/devops/azure-devops-oke/files/azure-token.yaml#L4"target="_NEW">line 4</a>.
78
86
79
87
## Setup Azure DevOps OCI connections for OKE and OCIR
80
88
@@ -93,7 +101,7 @@ To make the Azure DevOps pipeline to work with OCIR and OKE two <code>Service Co
93
101
<ul>
94
102
<li>Type: Kubernetes</li>
95
103
<li>Authentication method: Service Account</li>
96
-
<li>Server URL: OKE cluster server address from your <i>~/.kube/config</i> e.g. <i>https://145.144.233.100:6443</i></li>
104
+
<li>Server URL: OKE cluster server address from your <i>~/.kube/config</i> e.g. <i>https://xxx.144.233.100:6443</i></li>
97
105
<li>Authorization Secret: Get the secret JSON by doing <i>kubectl get secret oke-kubeconfig-azure-token -n kube-system -o json</i> and paste it here</li>
98
106
<li>Service connection name: OKE</li>
99
107
<li>Grant access permission to all pipelines: YES</li>
@@ -109,22 +117,22 @@ Edit the created pipeline and select <code>Variables</code> to create them as fo
109
117
110
118
<ul>
111
119
<li>CONTAINER_REGISTRY: OCIR</li>
112
-
<li>CONTAINER_REPOSITORY: Use the same name as in the <code>deployment.yaml</code> <a href="https://github.com/oracle-devrel/technology-engineering/tree/main/app-dev/devops-and-containers/devops/azure-devops-oke/deployment.yaml#L19">line 19</a> but <b><i>without</i></b> the <code>region</code> and the <code>tag</code> ("1" in the example YAML file) e.g. <b><i><TENANCY_NAMESPACE>/azure-test</i></b></li>
120
+
<li>CONTAINER_REPOSITORY: Use the same name as in the <code>deployment.yaml</code> <a href="https://github.com/oracle-devrel/technology-engineering/tree/main/app-dev/devops-and-containers/devops/azure-devops-oke/files/deployment.yaml#L19">line 19</a> but <b><i>without</i></b> the <code>region</code> and the <code>tag</code> ("1" in the example YAML file) e.g. <b><i><TENANCY_NAMESPACE>/azure-test</i></b></li>
113
121
<li>containerImageFullNameForK8sDeploy: The same as above but with the OCI region e.g. <b><i>fra.ocir.io/<TENANCY_NAMESPACE>/azure-test</i></b></li>
114
122
<li>K8S_CONNECTION_NAME: OKE</li>
115
123
<li>K8S_NAMESPACE: default</li>
116
124
<li>OcirPullSecret: ocirsecret</li>
117
125
</ul>
118
126
119
127
<p>
120
-
<imgsrc="pipeline-vars.png"width="800" />
128
+
<imgsrc="files/pipeline-vars.png"width="800" />
121
129
122
130
## Run the pipeline
123
131
124
132
Pipeline runs automatically after commiting changes and when all of the above are properly set it should complete succesfully.
- Simplify operations of enterprise-grade Kubernetes at scale. Easily deploy and manage resource-intensive workloads such as AI with automatic scaling, patching, and upgrades.
0 commit comments