Key Concepts of Kubernetes explained the basic fundamentals of Kubernetes. Binary distributions of Kubernetes on Linux can be downloaded from Continuous Integration builds. But it needs to manually built on other platforms, for example Mac. Building Kubernetes on Mac is straightforward as long as you know the steps.
This Tech Tip explains how to build Kubernetes on Mac.
Lets get started!
- Kubernetes is written using Go programming language. So you’ll need to download the tools/compilers to build Kubernetes.Install Go (golang.org/doc/install). For example Go 1.4 package for 64-bit Mac OS X can be downloaded from storage.googleapis.com/golang/go1.4.darwin-amd64-osx10.8.pkg.
- Configure Go. GOROOT is directory of Go installation is done and contains compiler/tools. GOPATH is directory for your Go projects / 3rd party libraries (downloaded with “go get”).Setup environment variables GOPATH and GOROOT. For example, on my environment they are:
123456~> echo $GOPATH/Users/arungupta/workspaces~> echo $GOROOT/usr/local/go
- Install Gnutar:
123456789101112131415> brew install gnu-tar==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gnu-tar-1.28.yosemite.bottle.2.tar.gzAlready downloaded: /Library/Caches/Homebrew/gnu-tar-1.28.yosemite.bottle.2.tar.gz==> Pouring gnu-tar-1.28.yosemite.bottle.2.tar.gz==> Caveatsgnu-tar has been installed as "gtar".If you really need to use it as "tar", you can add a "gnubin" directoryto your PATH from your bashrc like:PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"==> Summary/usr/local/Cellar/gnu-tar/1.28: 13 files, 1.6M
1234567+++ Output directory is local. No need to copy results out.+++ Building tarball: client darwin-386!!! GNU tar not available. User names will be embedded in output andrelease tars are not official. Build on Linux or install GNU taron Mac OS X (brew install gnu-tar)
- Tech Tip #39 shows how to get stared with Docker on Mac using boot2docker. Download boot2docker for Mac from github.com/boot2docker/osx-installer/releases and install.
- Git clone Kubernetes repo:
12345678910workspaces> git clone https://github.com/GoogleCloudPlatform/kubernetes.gitCloning into 'kubernetes'...remote: Counting objects: 36775, done.remote: Compressing objects: 100% (39/39), done.remote: Total 36775 (delta 11), reused 10 (delta 2)Receiving objects: 100% (36775/36775), 23.52 MiB | 1.72 MiB/s, done.Resolving deltas: 100% (24015/24015), done.Checking connectivity... done.
- Build it. This needs to be done from within the boot2docker VM.
12345678910111213141516171819202122232425262728293031kubernetes> ./build/release.sh+++ Verifying Prerequisites....+++ Setting boot2docker clock+++ Building Docker image kube-build:cross.+++ Building Docker image kube-build:build-67d37.+++ Running build command....+++ Building go targets for linux/amd64:cmd/kube-proxycmd/kube-apiservercmd/kube-controller-managercmd/kubeletplugin/cmd/kube-scheduler. . .+++ Integration test cleanup complete+++ Integration test cleanup complete+++ Running build command....+++ Output directory is local. No need to copy results out.+++ Building tarball: client darwin-386+++ Building tarball: client darwin-amd64+++ Building tarball: client linux-386+++ Building tarball: client linux-amd64+++ Building tarball: client linux-arm+++ Building tarball: client windows-amd64+++ Building tarball: server linux-amd64+++ Building tarball: salt+++ Building tarball: test+++ Building tarball: full
Subsequent blogs will show how to run a Kubernetes cluster of WildFly containers. WildFly will have a Java EE 7 application deployed and persist data to MySQL containers.