Posts in Category: docker

Bootstrapping the Kubernetes Control Plane

In this lab you will bootstrap the Kubernetes control plane across three compute instances and configure it for high availability. You will also create an external load balancer that exposes the Kubernetes API Servers to remote clients. The following components will be installed on each node: Kubernetes API Server, Scheduler, and Controller Manager.


The commands in this lab must be run on each controller instance: controller-0, controller-1, and controller-2. Login to each controller instance using the gcloud command. Example:

gcloud compute ssh controller-0

Running commands in parallel with tmux

tmux can be used to run commands on multiple compute instances at the same time. See the Running commands in parallel with tmux section in the Prerequisites lab.

Provision the Kubernetes Control Plane

Create the Kubernetes configuration directory:

sudo mkdir -p /etc/kubernetes/config

Download and Install the Kubernetes

Install Docker for mac using homebrew

Here’s the command I ran:

brew install bash-completion
brew cask install docker
brew install kubectl
brew cask install minikube

Then go to the gui launcher and start up docker, and follow the prompts.

Then open a terminal and you should fine the following cli tools installed.

$ docker version
Docker version 17.09.0-ce, build afdb6d4

$ docker-compose version
docker-compose version 1.16.1, build 6d1ac21

$ docker-machine --version
docker-machine version 0.12.2, build 9371605

$ kubectl version --client
Client Version: version.Info{Major:"1", Minor:"6", GitVersion:"v1.6.2", GitCommit:"477efc3cbe6a7effca06bd1452fa356e2201e1ee", GitTreeState:"clean", BuildDate:"2017-04-19T20:33:11Z", GoVersion:"go1.7.5", Compiler:"gc", Platform:"darwin/amd64"}


Docker for Mac install

Get bash autocompletion working for docker cli on a mac

First install the following formulas:

brew install bash-completion
brew cask install docker

Next via the gui launcher, find the docker icon and launch it, then follow the prompts. Then restart your bash terminal. Now run the following command to create a few symbolic links:

ln -s /Applications/ /usr/local/etc/bash_completion.d/docker
ln -s /Applications/ /usr/local/etc/bash_completion.d/docker-machine
ln -s /Applications/ /usr/local/etc/bash_completion.d/docker-compose

Then restart the bash terminal. Therefore running the above ln commands resulted in the following files being created:

$ pwd
$ cd /usr/local/etc/bash_completion.d/
$ ll | grep docker
-rw-r--r--  1 schowdhury  admin     15 19 Oct 11:18 docker
-rw-r--r--  1 schowdhury  admin     15 19 Oct 11:18 docker-compose
-rw-r--r--  1 schowdhury  admin  10347 19 Oct 11:18 docker-machine
-rw-r--r--  1 schowdhury  admin   1469 19 Oct 11:19 docker-machine-prompt
-rw-r--r--  1															

Docker – An apache ‘hello world’ example

Here we’re going to build a simple docker container that is running apache web server and then access it from your laptop’s web browser.

We will be building our container using the official ubuntu docker image.

First off, pull down the ubuntu image, by running:

$ docker pull ubuntu
Using default tag: latest
latest: Pulling from library/ubuntu
ae79f2514705: Pull complete
5ad56d5fc149: Pull complete
170e558760e8: Pull complete
395460e233f5: Pull complete
6f01dc62e444: Pull complete
Digest: sha256:506e2d5852de1d7c90d538c5332bd3cc33b9cbd26f6ca653875899c505c82687
Status: Downloaded newer image for ubuntu:latest

Then confirm that you have this image now:

$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED