In this guide we'll cover the full cycle of deploying to Kubernetes using Github Actions. Batteries included:
Kubernetes cluster running in AWS E...
For further actions, you may consider blocking this person and/or reporting abuse
This is great! Can we add a revert/rollback in the event of a failure after deployment ?
yup, that’s perfectly possible
I’d love to see how it will fetch the rollback sha(one previous to the failed deployment), and the previous ECR image. Would this be added in a new post, or to the current? :-)
A Kubernetes deployment keeps N deploy versions, aka docker images. So a rollout rollback is simply switching back to the previous image already present in the cluster. Is that you’re looking for or I’m missing some point?
Yes, very similar, just trying to incorporate to what you have developed a rollback option :-)
As a final step, i tweaked the GitHub action step with:
helm upgrade my-application -f helm/values-${{ env.ENV_NAME }}.yaml --set image.tag="${{ env.SHA }}" helm/ -n ${{ env.ENV_NAME }}-apps -v 20
I like your step to "Verify Kubernetes deployment", based on that output, i'm trying to see how i can rollback in the event of a failed deployment.
for example a GitHub action to use
kubectl rollout history
orkubectl set image
but the later uses--record
which will be deprecated.Much appreciated...BTW, been enjoying all your articles, and looking forward to see your statefulsets on k8s!
Okay, I got it. Today later I’ll check your good insights and how to fit it in this example, thanks!
Thank you Leandro, It was really helpful.
I tried these steps but failing at build satge even after trying some solutions from the internet. Could you please help?
==
0s
Run actions/cache@v2
with:
path: /tmp/.buildx-cache
key: Linux-single-buildx-a0e66f3b0efdba7f889770a006153d36b421b028
restore-keys: Linux-single-buildx
env:
RELEASE_REVISION: pr--
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
AWS_REGION: ***
KUBE_CONFIG_DATA: ***
KUBE_NAMESPACE: default
ECR_REPOSITORY: app-api
SLACK_WEBHOOK_URL: ***
AWS_DEFAULT_REGION: ***
Cache not found for input keys: Linux-single-buildx-a0e66f3b0efdba7f889770a006153d36b421b028, Linux-single-buildx
2s
Run docker buildx create --use
docker buildx create --use
docker buildx build \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache-new \
--tag .dkr.ecr..amazonaws.com/app-api:pr-- \
--target build-stage \
--push \
.
shell: /usr/bin/bash -e {0}
env:
RELEASE_REVISION: pr--
AWS_ACCESS_KEY_ID: ***
AWS_SECRET_ACCESS_KEY: ***
AWS_REGION: ***
KUBE_CONFIG_DATA: ***
KUBE_NAMESPACE: default
ECR_REPOSITORY: app-api
SLACK_WEBHOOK_URL: ***
AWS_DEFAULT_REGION: ***
ECR_REGISTRY: .dkr.ecr..amazonaws.com
RELEASE_IMAGE: .dkr.ecr..amazonaws.com/cleva-api:pr--
nice_benz
time="2021-11-09T17:04:14Z" level=warning msg="No output specified for docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load"
1 [internal] booting buildkit
1 pulling image moby/buildkit:buildx-stable-1
1 pulling image moby/buildkit:buildx-stable-1 0.8s done
1 creating container buildx_buildkit_nice_benz0
1 creating container buildx_buildkit_nice_benz0 0.7s done
1 DONE 1.5s
error: unable to prepare context: path " " not found
Error: Process completed with exit code 1.
This should help
You're putting in great content, bud.
Keep going, I'll be back.
I enjoy and learn with your writings! Yes, do it more 💪🏻
Oh man, I really need to. It's been 3 months since my last post. Meh.
And btw, I'm entertaining the idea of writing in English. Let's see.
Thank you for your post!
BTW, is it possible to run a few commands inside one step, like "set image... ; get rollout status..."?
i got this error from deploying the image on k8s :
The connection to the server localhost:8080 was refused - did you specify the right host or port?
How can i fix it .. thanks in advance
Hi Leandro, nice article! Do you know how to deploy an image from docker hub into aws eks? Thks!
In "Deploy to Kubernetes cluster" action, I'm getting below error:
Error from server (NotFound): deployments.apps "my-pod" not found