Difficulty: beginner
Estimated Time: 20 minutes

This course gives a high-level overview of how to deploy web apps to Kubernetes and how to make them reachable by your users.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Kubernetes 101

Step 1 of 4

Step 1 - Deploying your app

To get started we're going to create a deployment object. This is one of the most commonly used object and represents a set of pods - or replicas.

Task

Copy the definition from below. This launches an application called webapp1 which uses the katacoda/docker-http-server docker image for it's containers on port 80. This is just a basic NGINX web server which echoes the host name back.

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: webapp1
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: webapp1
    spec:
      containers:
      - name: webapp1
        image: katacoda/docker-http-server:latest
        ports:
        - containerPort: 80

Once this is copied into the editor you can type in the following command in the terminal to start the deployment.

kubectl apply -f deployment.yaml

To see if the deployment is ready, type the following command in the terminal.

kubectl get deployments

To see the actual pods, use the following command.

kubectl get pods

Pro tip

Never used Katacoda before? Noticed there's a button "copy to editor" next to the code samples? Also you can click on the commands and it will be executed in the terminal.

deployment.yaml
service.yaml
ingress.yaml
routing.yaml