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
Copy file name to clipboardExpand all lines: challenge9/readme.md
+134Lines changed: 134 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,141 @@ Good luck! This connects the final dots in your DevOps pipeline.
37
37
## Solution
38
38
39
39
### Deployment Update Strategy:
40
+
The rolling update strategy is the ideal strategy to update the deployment with the new image, we can acheive it using both imperative command and imperative object configuration
41
+
42
+
1. in imperative command we use the command line to update the image of our deployment
43
+
`kubectl set image deployments/my-app-deployment container=rajrishab/challeneg9:ascbasd`
44
+
45
+
2. in imperative object configuration we update the deployment configuration and then appy the configuration using following command
46
+
`kubectl apply -f deployment.yaml`
47
+
48
+
49
+
In both of these approaches kubernetes will update the pod one by one, meaning it will scheudled on the nodes with available resources and it will wait for the pod to get created and after that the pod is created it will remove the old pods from the cluster.
40
50
41
51
### GitHub Actions CD Script:
42
52
53
+
We can use the following CD steps to update our deployment
3. Then create a runner deployment which will act as the remote runner to run our CD pipeline
125
+
126
+
```yaml
127
+
apiVersion: actions.summerwind.dev/v1alpha1
128
+
kind: RunnerDeployment
129
+
metadata:
130
+
name: kubernetes-runner
131
+
spec:
132
+
replicas: 1
133
+
template:
134
+
spec:
135
+
serviceAccountName: runner-sa # This ServiceAccount needs permissions
136
+
repository: your_github_username/your-repository-name # Update to your target repo (e.g., siddhant-khisty/key-store-gin)
137
+
labels:
138
+
- "kubernetes-runner" # Label to target this runner in your workflow
139
+
```
140
+
141
+
4. then create a service account which we will use to authenticate and authorize our remote runner to make requests/changes to our cluster using following command
142
+
143
+
`kubectl create sa runner-sa -n actions-runner-system`
144
+
145
+
146
+
5. then create a ClusterRole and ClusterRoleBinding to assign the necessary permissions to the service account using following config
6. Then generate the token of the service account which we will save in our github repo as secret. so that our github action can use the token to register our service account in the remote runner, when remote runner will make request to our API server it will have this TOKEN so that our API server can authenticate and authorize it.
0 commit comments