40 days of K8s - CKA challenge (02/40)
Day 01/40 using Dcokerfile to Containerize my work into Docker container vibe coding - testing my skills taking the #40DaysOfk8s Challange is a commitmenet no doubt about it. Day 2 of the challenge brought some important insights: Based on a clear understanding of my strengths and limitations, both in terms of focus and available time: I realized, that the only way I’ll consistently stick to the challenge, is by making it genuinely interesting for me. Sure, complex and technical challenges can be interesting on their own. But here’s the catch: I need to find the personal challenge, especially in the easy ones ... Let’s be honest: writing a Dockerfile isn’t what gets me excite (especially not a straigh forward one ... ) but it is the bread an butter of DevOps, and on the other side : if I start skipping tasks, or cutting corners, I’ll never finish this challenge. So, here’s the formula I’m embracing: Consistency = Engagement = Commitment the only way I am going to stick with it, is determind by the how long i stay interested in it. Choosing the Right Project for Presentaition Early in the day, I asked myself: Should I build on one of my many existing projects? Or use this opportunity to experiment with something new—maybe a little VibeCoding? Truth is, I have a cool project involving Kafka and Redis that I’ll definitely showcase later on. But for now, I wanted to take today’s relatively simple task and infuse it with creativity I decided going on a Vibe programming task - just to make it interesting I will create a project out of prompting along and use this code to dockerize my 2nd day challange. but wait : how would i work ? I want it to be both consistant and professional how will I track the progress and follow changes ? I decided to FORK the original repository done by @piyushsachdeva. by doing so, I can later on override it (adding my staff to MY!! forked project) more then this : using registration on @piyushsachdev repository events (by GitHub webhoooks or third party tools , or even manually scheduled automation) I may automate processes to fetch any future changes done by @piyushsachdeva in the future. this can be done with gitactions that I can implement in my repo once you FORK a repo - you get link to the upstream path to the repo that you FORK from so using fetch from upstrim you can always get the changes done manuall you can aloso set manually "upstream" remote link and later fetch from git remote add upstream https://github.com/piyushsachdeva/CKA-2024 after creating upstream you can check existance with : git remote -v and then can fetch changes anytime manually : git fetch upstream git log HEAD..upstream/main --oneline # shows commits you don't have or even with GitHub-Actions Creating my project - using Vibe-Programming So i have a forked project. now we go to day02 and adding Dockerfile there this is done by creating a branch for every cahnge - actuially I decided a branch for every day of change the dockerfile will be used with build of the docker image, created for my project. lets create a project. as memtioned earlier : I decided VIBE CODING vibe coding is a new approach of writing code by asking AI tool to generate it. so I started with the big weapon : and asked it with a nice prompt to write me a 4 in a row game : I want a frontend aplication of 4 in a row a user will start a game against the compuiter the computer will have 8 different levels 2 select - each level is another depth of thinking ( a step forwared , 2 steps forward till 10 steps forward the game board size ( columns / rows) can be set at initialization with the selection of level that's it the application was ready to work and I got a game. not fully functioning, but good enough ... so i continued : add a new game button and a hint button allow the user to declare hoe many hints he can get in a game and allow to request as loong as its not ver because I felt this was neaded ... padam padam : a game was born : that easy but the problem is that I couldnt take the code out ... well, some code was available but it did not work alone and the tol didnt let me access to the code .... so I decided to use my own work env to vibe programming I decided to work with openai - just because I trust it the most I use AI a lot (even wrote some experts ...) and I use well I use it to create movies and pictures , to generate data and even to generate enhanced prompts ... I could use the agent ability of the copilot, but I wanted to use manual progress with chatgpt - to monitor its progress and way of thinking (after all - as I mentioned before : I trust it the most) but not only : after decided to work with GPT , I decided totake the product tcreated with it and pass it throught copilot pair programming tool and the windsurf (codium)

Day 01/40
using Dcokerfile to Containerize my work into Docker container
vibe coding - testing my skills
taking the #40DaysOfk8s Challange is a commitmenet
no doubt about it.
Day 2 of the challenge brought some important insights:
Based on a clear understanding of my strengths and limitations,
both in terms of focus and available time: I realized, that the only way I’ll consistently stick to the challenge, is by making it
genuinely interesting for me.
Sure, complex and technical challenges can be interesting on their own.
But here’s the catch: I need to find the personal challenge, especially in the easy ones ...
Let’s be honest: writing a Dockerfile isn’t what gets me excite (especially not a straigh forward one ... ) but it is the bread an butter of DevOps, and on the other side : if I start skipping tasks, or cutting corners, I’ll never finish this challenge.
So, here’s the formula I’m embracing:
Consistency = Engagement = Commitment
the only way I am going to stick with it, is determind by the how long i stay interested in it.
Choosing the Right Project for Presentaition
Early in the day, I asked myself:
Should I build on one of my many existing projects?
Or use this opportunity to experiment with something new—maybe a little VibeCoding?
Truth is, I have a cool project involving Kafka and Redis that I’ll definitely showcase later on.
But for now, I wanted to take today’s relatively simple task and infuse it with creativity
I decided going on a Vibe programming task - just to make it interesting
I will create a project out of prompting along
and use this code to dockerize my 2nd day challange.
but wait : how would i work ? I want it to be both consistant and professional
how will I track the progress and follow changes ?
I decided to FORK the original repository done by @piyushsachdeva.
by doing so, I can later on override it (adding my staff to MY!! forked project)
more then this :
using registration on @piyushsachdev repository events (by GitHub webhoooks or third party tools , or even manually scheduled automation) I may automate processes to fetch any future changes done by @piyushsachdeva in the future.
this can be done with gitactions that I can implement in my repo
once you FORK a repo - you get link to the upstream path to the repo that you FORK from
so using fetch from upstrim you can always get the changes done manuall
you can aloso set manually "upstream" remote link and later fetch from
git remote add upstream https://github.com/piyushsachdeva/CKA-2024
after creating upstream you can check existance with :
git remote -v
and then can fetch changes anytime manually :
git fetch upstream
git log HEAD..upstream/main --oneline # shows commits you don't have
or even with GitHub-Actions
Creating my project - using Vibe-Programming
So i have a forked project.
now we go to day02 and adding Dockerfile there
this is done by creating a branch for every cahnge - actuially I decided a branch for every day of change
the dockerfile will be used with build of the docker image, created for my project.
lets create a project.
as memtioned earlier : I decided VIBE CODING
vibe coding is a new approach of writing code by asking AI tool to generate it.
so I started with the big weapon :
and asked it with a nice prompt to write me a 4 in a row game :
I want a frontend aplication of 4 in a row a user will start a game against the compuiter the computer will have 8 different levels 2 select - each level is another depth of thinking ( a step forwared , 2 steps forward till 10 steps forward
the game board size ( columns / rows) can be set at initialization with the selection of level
that's it
the application was ready to work and I got a game.
not fully functioning, but good enough ...
so i continued :
add a new game button and a hint button
allow the user to declare hoe many hints he can get in a game and allow to request as loong as its not ver
because I felt this was neaded
...
padam padam :
a game was born :
that easy
but the problem is that I couldnt take the code out ...
well, some code was available
but it did not work alone
and the tol didnt let me access to the code ....
so I decided to use my own work env to vibe programming
I decided to work with openai - just because I trust it the most
I use AI a lot (even wrote some experts ...) and I use well
I use it to create movies and pictures , to generate data and even to generate enhanced prompts ...
I could use the agent ability of the copilot, but I wanted to use manual progress with chatgpt - to monitor its progress and way of thinking (after all - as I mentioned before : I trust it the most)
but not only : after decided to work with GPT , I decided totake the product tcreated with it and pass it throught copilot pair programming tool and the windsurf (codium) addon as well
so I actually used 3 different tools to creat this code : ....
Workflow with GPT + Copilot + windsurf
I asked GPT to start
I asked it to create a 4-in-a-row aplication, I even added a printscreen of the setting window (created by base44)
after describing to request - I asked it to generate the filetree of the prooject
I also asked it to create the tree with bash script
then I asked it to write to me 10 questions that it might think that are need to accomplish the task
thne , asked it to write all files , and added : before each file write the name of the file in remark ...
#vibe programming - Real-Time Code Generation - 4InARow - react
I want you to help me create a full react application for a 4 in a row game
the game has this opening screen (see attached)
the game is against computer.
on setting screen the user can selecti the difficulty level (which is how many steps the oponent computer can calculate ahead), the rows and columns (for board) , the number of hints a user can ask the computer to hint him for the best next move he can do .
while playing - each time the user request a hint - the number of available hints reduces
pls ask me any question before start
it asked me question - on which i answered ...
then after some inquieries I declared the AI computer algorithm of game :
pls add filetree for the project
it had some game logistics issues which I ansered and the nit started to work
it went into canvas mode.
and then streted writing files
and deleting them
and rewriting them again and deleating again
for several minutes, with stops between ....
and at the end created files that I decided to copy and paste (I could asked it to generate a zip file , but wanted to follow it manually .... )
so i copied all script to the right files ...
after having this files - I asked also to genearate package.json
and the with the created code I faced to the other co-workers :
windsurf and copilot
over here it was a bit simpler - since they are embedded inside the vscode (also in cursor ... )
so I asked it (both) to identefy the project files and add bootstrap correctly ...
it added some coded for bootstrapping
and staff
and some changes in aths of components that are not created in the right path ...
and thisis it ...
I have a working project ...
i created the git repo for it and pushed it ther
not inside my #40DaysOfK8s challange repo , but outside of it
adding a subproject to Github repo
working with the #40DaysOfK8s challange repo - I wanted to maintain this repo clear to its purpose
no other repositories need to reside inside.
if I have this 4-in-a-row project - and I want to change it later on - i will not change it in #40DaysOfK8s repo.
more then this : I dont want to maintain other repos in this one repo.
but I do need to keep this repo files inside Day02 folder - sicne I ant to creatre a docker image for it
solution Git submoduled
Git submodules are actually links to a real repository. it is an ideal solution to components development when you dont want to duplicate your components in several projects in your organization.
unlkike subtrees that are actually copies of specific repo - this acts like links to another repo
like other objects - you can set git hooks to monitor the real repo changes and according to this to update the files in the linked submodule
creation of submodule is pretty straight forward :
go to the path of the repo where you wantto create the submodule :
cd ./Resources/Day02
git submodule add https://github.com/idubi/4-in-a-row.git 4-in-a-row
Building Docker Image steps for deployment
now we need to build the Docker image for deployment.
this are the steps :
- crate a Dockerfile for deployment of react application 4_in_a_row
sicne the application is at "4-in-a-row: directory
the dockerfile looks like this :
FROM node:18-alpine
WORKDIR /app
COPY ./4-in-a-row .
RUN yarn && yarn build
CMD [ "yarn", "start" ]
EXPOSE 5173
since the react is packed with vite - the commands to execute the execution of react are different :
RUN yarn && yarn build
CMD [ "yarn", "start" ]
- build the image with Dockerfile
docker build . -t four-in-a-row_alpine18
- run the image locally to make suer you have it runing
docker run -d --name 4inarow2 -p 5173:5173 four-in-a-row_alpine18
and make sure the aplcation is working :
- tag the image for uniquenes
docker tag four-in-a-row_alpine18:latest idubi/four-in-a-row:latest
- push the image to docker repository (for now Docker-Hub)
docker push idubi/four-in-a-row:latest
- delete the image from local dcoker and pull the docker image this is done to make sure pull works and run correctly (the pull is done from repository)
docker pull idubi/four-in-a-row:latest
docker run -d --name test idubi/four-in-a-row:latest
if anyone want me to go on either of the subjects I discussed here please write in comments :
- github actions , hooks , 3rd party ...
- github submodule / subtree
- different AI approaches for the AI game setting -
- what is a deep learnign model.
- how we can train a machine
- how to train a model using Reinforcmeent learnign approaches