Kubernetes gives system administrators the means to manage containerized applications. To get started, we need to deploy an application inside of our Kubernetes cluster. From there, Kubernetes will manage many aspects of our application, plus give us tools to interact with it as needed. In this tutorial, we will go through the step by step instructions to deploy an application in Kubernetes on a Linux system.
In this tutorial you will learn:
- How to build a Docker image
- How to deploy a Docker image to Kubernetes
- How to check status info on deployed applications

Category | Requirements, Conventions or Software Version Used |
---|---|
System | Any Linux distro |
Software | Docker, Kubernetes |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
Deploy an Application in Kubernetes step by step instructions
The instructions assume that you already have your Kubernetes cluster up and running. In the steps below, we will be creating a containerized application by using Docker, and then deploying that application on to our Kubernetes cluster. Let’s get started!
-
Create Docker Image
The first thing we will do is create a Docker image using Dockerfile. This will just be a simple image that contains a default Apache web server for our example, but feel free to build an image of whatever application you need to. Our
Dockerfile
contains the following:FROM ubuntu:22.04 LABEL maintainer="korbin@linuxconfig.org" RUN apt-get update && apt-get -y install apache2 EXPOSE 80
Move into the root directory of your project and run the
docker build
command to build your image.$ sudo docker build -t linuxconfig/apache .
- We can verify that the Docker image was created and is ready to use by executing:
$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE linuxconfig/apache latest 4c7c99b254a2 22 seconds ago 228MB
- You can now upload your application to a central repository such as Docker Hub for global access.
$ docker login $ docker push linuxconfig/apache
- Next, let’s create a Kubernetes deployment manifest file. There are many options we can apply in this file, including the amount of replicas that we want to run. Since this is our first time deploying an application in Kubernetes, we will keep it simple in this example, and not include any replicas or scaling. Create the following file and substitute any values accordingly:
apiVersion: v1 kind: Pod metadata: name: apache spec: containers: - name: apache2 image: linuxconfig/apache:latest ports: - containerPort: 6379
We will save this file as
apache-deployment.yml
. - Next, deploy the application on to Kubernetes using the following
kubectl
command.$ kubectl create -f apache-deployment.yml
Note: you may need to run the command with
sudo
, depending on your Kubernetes configuration. - To see your pod deployment, as well as any others, execute the following command:
$ kubectl get pods
We can see additional information about the specific application we just deployed by executing:
$ kubectl get pods/apache
And more detailed information with the
describe
argument:$ kubectl describe pods/apache

Closing Thoughts
In this tutorial, we saw how to deploy an application in Kubernetes on a Linux system. We used Docker to create a simple image, upload it to a central repository, and then use the
kubectl
command to retrieve the container and deploy it onto our Kubernetes cluster. Using the kubectl describe
command, we can see the deployed container running on a worker node in our cluster.