Deploy Kubernetes App with Docker For Windows

In this blog post, I’ll show you how I deploy a basic web server application with Kubernetes running on Docker For Windows on my windows 10 machine.

On my host, I’m running Kubernetes v1.92 which was released a few days ago and at this stage, Kubernetes Is only working with Linux Containers.

When enabled, Kubernetes on Docker For Windows Includes a standalone server, client and the Docker CLI In a non-configurable configuration (single node cluster).

About Kubernetes

Kubernetes is an open-source system for automating deployment, scaling and management of containerized applications that was originally designed by Google and donated to the Cloud Native Computing Foundation.

Get Started

Before you started you will need to enable Kubernetes on Window 10.

Once Installed and running, I can view all the available commands on Kubernetes type the line below:

kubectl

To check the Kubernetes version I’ll use the command below and as you can see I’m running version v.19.2

kubectl get nodes

.YML FILE

Kubernetes. YML configuration file Is not the same as Docker Compose file and this post, I’ll use the example below to create a very basic web application.

version: '3.3'

services:

web:

build: web

image: httpd:alpine

volumes:

- "./web/static:/static"

ports:

- "80:80"
Docker Stack

To deploy an application to Kubernetes, I’ll use the command below from the location of my .YML file

docker stack deploy --compose-file docker-compose.yml http

Once done, I can use docker cmdlet to view all running containers and application

docker ps

To view services running on Kubernetes I use the command below

docker stack ls

To remove Kubernetes application I use.

docker stack rm http

And to view all running applications and services and open ports I use the line below.

kubectl get services

This blog post was first published on DeployContainers.com

 


Posted

in

,

by