This repository contains the Kubernetes Cluster Manifests for the Computas DevOps 101 workshop. This readme is for the workshop participants, if you are an instructor and need the Setup instructions see here.
So far you've created your own application repository, added CI workflows that automatically build and push your container images, declared how you want your application to be deployed, and you've forked this repository. The reason you forked this repository is that you want to propose a change to the cx-devops-101/k8s-infra repository, where you tell the GitOps operator about your application's workload manifests. In stark opposite from before, this time we actually do want the pull-requests to be merged back into the original repository, i.e. cx-devops-101/k8s-infra, so make a mental note of that. Let's begin adding our new application to the cluster.
The declaration of our application will consist of a new directory with three files:
<github-username>/namespace.yaml
: In this file we declare the namespace that we want to deploy our application into.<github-username>/notes-app-source.yaml
: In this file we tell the GitOps operator about our application repository.<github-username>/notes-app.yaml
: In this file we tell the GitOps operator where to find the kubernetes workload manifests for our application in the repository we told it about in the previous file.
Adding new files to a new directory through the GitHub website is a bit more difficult to explain in text but we'll try our best, though hopefully the instructors has already shown you how. First off, navigate to the cluster-production directory. Before we continue, open the notes-app in a new browser tab, you'll need it later.
- Click on
Add file
in the upper-right corner of the file view. - Then click on
Create new file
. - You should be redirected to a text-editor where you'll see a
Name your file...
text input. - Type in
<github-username>/namespace.yaml
. When you've added the/
the UI will make it clear that it understands that you want to put the file in a directory named<github-username>
. - Open notes-app/namespace.yaml in a new tab, and copy the file contents.
- Paste the contents into your new file.
- Replace
name: notes-app
withname: <github-username>
. - Commit the file directly to the
main
-branch.
- Navigate to the
<github-username>
directory you added when you creatednamespace.yaml
. - Then click on
Create new file
. - Enter
notes-app-source.yaml
as the filename. - Open notes-app/notes-app-source.yaml in a new tab, and copy the file contents.
- Paste the contents into your new file.
- Replace
name: notes-app
withname: <github-username>
. - Replace
branch: production
withbranch: master
. - Replace
https://github.com/cx-devops-101/notes-app
with the url to your notes-app repository, e.g.https://github.com/<github-username>/notes-app
. - Commit the file directly to the
main
-branch.
- Navigate to the
<github-username>
directory you added when you creatednamespace.yaml
. - Then click on
Create new file
. - Enter
notes-app.yaml
as the filename. - Open notes-app/notes-app.yaml in a new tab, and copy the file contents.
- Paste the contents into your new file.
- Replace both instances of
name: notes-app
withname: <github-username>
. - Replace
branch: production
withbranch: master
. - Replace
targetNamespace: notes-app
withtargetNamespace: <github-username>
- Commit the file directly to the
main
-branch.
At this point you should have added some new files to your fork of cx-devops-101/k8s-infra,
and you should be ready to create a pull request back to the source repository. Navigate back to the root of your repository. You should
see a grey box where it says This branch is 3 commits ahead of cx-devops-101:main.
with a Pull request
link to the right, click on it.
You should be redirected to a page with the title Comparing changes
, and you should see the following at the top:
base repository: cx-devops-101/k8s-infra
andbase: main
head repository: <github-username>/k8s-infra
andcompare: main
Able to merge
If all that seems to match up, then go ahead and create the pull request. A maintainer of cx-devops-101/k8s-infra
will look at your pull request as soon as possible, and when it is merged your application should quickly be available at the domain
you declared in the igress.yaml in your notes-app
repository, e.g. http://<github-username>.devops.rosbach.no
.