Skip to content

Gogistics/prjKubeOpenStack-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Deploy Kubernetes cluster on OpenStack

This tutorial aims to guide the developers how to deploy a Kubernetes cluster on OpenStack, the solution may also work for private clouds. One of advantages of deploying Kubernetes cluster from scratch because the developers will be able to seemlessly set up Kubernetes clusters on different platforms, especially private ones. In this tutorial, the Kubernetes cluster will be deployed in OpenStack inside the private cloud.

References: Basic and DSR load balancing with network load balancers (NLB)

Before starting the deployment and provisioning, you need to know the relationships between things:

  1. The relationship between the network created by OpenStack and the Kubernetes cluster
  2. The relationship between the network created by OpenStack and the WAN

See the diagram as reference.

The steps of deploying Kubernetes cluster are (say the OpenStack is running properly):

  1. Create a network and a host server (this step is skipped because this tutorial is for learning deployment of Kubernets cluster from scratch)
  2. Create the servers that will run Kubernets master and workers. (I suggest at least creating three servers, one is running as the master, and the other two are running as the workers.)
# In my case, a server can be instantiated by the following command and runs in Ubuntu 16.04.1 LTS. Once the server is instantiated, remember to note down the server IP
$ openstack server create --image <image-id> --flavor <flavor-id> --network <network-id> --key-name <key-name> --wait <server-host-name>

Reference: OpenStack CLI cheatsheet

  1. Provision the servers to support Kubernetes

Please refer to provision/guide.md

  1. Deployment of Redis cluster

4-1. Write yaml files 4-2. Kubectl create/apply the yaml files

Reference: Deploying PHP Guestbook application with Redis

  1. Development of applications in Golang (WIP) In this tutorial, I wrote the applications in Golang. Feel free to write the applications in your favirote languages

Build the Golang application

$ docker build -t alantai/web-state:v0.1.1 -f dockerfiles/Dockerfile.apis_state .

Tag the Docker image

$ docker tag alantai/web-state:v0.1.1 quay.io/ocedo/scm-ui:web-state-v0.1.1

Push to Docker registry

$ docker push quay.io/ocedo/scm-ui:web-state-v0.1.1
  1. Deploy the Golang application and the service 6-1. go to the kube-master console and update the image tag in the yaml file 6-2. make sure the LoadBalancer IP is exported and run the following command
$ envsubst < kube-apis-state-quay.yaml | kubectl apply -f -

References: dumb-init Introducing dumb-init, an init system for Docker containers

  1. Manage the Kubernetes cluster Here I just wrote some simple examples. Feel free to try otehr Kubernetes mechanisms.
# scale deployment
$ kubectl scale deployment apis-state --replicas=6

# rollback deployment
$ kubectl rollout status deployment/<deployment-name>
$ kubectl rollout history deployment/<deployment-name>
$ kubectl rollout undo deployment/<deployment-name>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published