/ mozey.co / blog


November 10, 2016

🔗 Terraform

🔗 Minikube

Minikube starts a single node kubernetes cluster locally for purposes of development and testing

🔗 Install virtual box

🔗 Install minikube

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.12.2/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

🔗 Install kubectl

curl -Lo kubectl http://storage.googleapis.com/kubernetes-release/release/v1.3.0/bin/darwin/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/fire

🔗 Dashboard

Install and open the latest stable release

kubectl create -f https://rawgit.com/kubernetes/dashboard/master/src/deploy/kubernetes-dashboard.yaml

minikube dashboard

🔗 Pod runs boot2docker

minikube docker-env

minikube ssh

ls /Users

🔗 Getting Started

Inspect the cluster

kubectl get pods --all-namespaces

kubectl get nodes

🔗 Run the built-in hello-minikube

kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080

kubectl get pods

kubectl get deployments

Expose the deployment to an external IP

kubectl expose deployment hello-minikube --type=NodePort

kubectl get services

curl $(minikube service hello-minikube --url)

Delete deployment and service

kubectl delete service,deployment hello-minikube

🔗 Build and install a node service with Docker

Install Docker for Mac

Start Docker.app

Create service files and build image

cd ~ && mkdir hello-node

echo "var http = require('http');
var handleRequest = function(request, response) {
  response.end('Hello World!');
var helloServer = http.createServer(handleRequest);
helloServer.listen(8080);" > hello-node/server.js

echo "FROM node:4.4
COPY server.js .
CMD node server.js" > hello-node/Dockerfile

tree hello-node

cd hello-node 

docker build -t hello-node:v1 .

Show images

docker images

Run a private local registry

docker run -d -p 5000:5000 --restart=always --name registry registry:2

docker tag c9fb1ebe09f8 localhost:5000/hello-node:v1

docker push localhost:5000/hello-node:v1

Deploy the hello-node pod


kubectl run hello-node --image= --port=8080

🔗 TODO kubectl run error

Get tls: oversized record received with length 20527 from kubernetes dashboard possibly because of –image url format?

kubectl expose deployment hello-node --type=NodePort

curl $(minikube service hello-node --url)


kubectl delete service,deployment hello-node

docker rmi hello-node

🔗 kubectl for Docker Users

🔗 elasticsearch