Deploying the Application

This lesson shows the step-by-step process of deploying a demo application.

Cloning the repository#

It would be hard for us to start destroying instances of an application if we do not have any. So, the first thing we’re going to do, now that we have a cluster, is deploy a demo application. I’ve already prepared one that you can use.

We’re going to clone my repository vfarcic/go-demo-8 that contains a very simple demo application. It contains just enough complexity or simplicity, depending on how you look at it. We’ll use it for all our chaos experiments.

So, let’s clone the application repository.

Next, we’ll enter into the directory where the repository was cloned. In case you already have that repository from some other exercises you have done with me, we’re going to pull the latest version.

It shouldn’t matter whether you cloned the repo for the first time, or you entered into a copy of the existing repo and pulled the code. In any case, you must always have the latest version because I might have changed something.

Creating a namespace#

Everything in this course will be created in separate namespaces so that the rest of your cluster is not affected (much). With that in mind, we are going to create a namespace called go-demo-8.

Exploring the application definition#

Next, we’re going to take a quick look at the definition of the application we’re going to deploy. It is located in the terminate-pods directory, in a file called pod.yaml.

The output is as follows.

---

apiVersionv1
kindPod
metadata:
  namego-demo-8
  labels:
    appgo-demo-8
spec:
  containers:
  - namego-demo-8
    imagevfarcic/go-demo-8:0.0.1
    env:
    - nameDB
      valuego-demo-8-db
    ports:
    - containerPort8080
    livenessProbe:
      httpGet:
        path/
        port8080
    readinessProbe:
      httpGet:
        path/
        port8080
    resources:
        limits:
          cpu100m
          memory50Mi
        requests:
          cpu50m
          memory20Mi

As you can see, this is a very simple definition of an application. It is an app defined as a single Pod that has only one container called go-demo-8. It is based on my image vfarcic/go-demo-8. It has an environment variable, but that is not really important. Finally, there are livenessProbe, readinessProbe, and some resources. If you have any familiarity with Kubernetes, this is as simple as it can get. It’s a definition of a pod.

If you’re not familiar with Kubernetes, then this might be too advanced, and you might want to check some other resources and get familiar with Kubernetes first. I can recommend my course, A Practical Guide to Kubernetes, but any other resource should do. What matters is that I assume that you have at least basic knowledge of Kubernetes. If not, stop reading this, and learn at least fundamentals.

Applying the definition to the cluster#

Now that we have seen the definition of the application in the form of a single Pod, we are going to apply that definition to our cluster inside the go-demo-8 Namespace.

That’s about it. We have our application up and running as a Pod.

Now, let’s see how we can destroy it. What damage can we do to the application? Let’s be destructive and figure out how we can improve things through the chaos.


In the next lesson, we will be installing the Chaos Toolkit Kubernetes plugin and discovering its functionalities.

Creating a Cluster
Discovering Chaos Toolkit Kubernetes Plugin
Mark as Completed
Report an Issue