Kubernetes for Mac

Run Kubernetes Natively on Mac

Here’s the native Docker for Mac (xhyve) solution we contribute heavily to.

# Pull down the Code:

git clone https://github.com/streamplace/kube-for-mac.git

# Link the Kubernetes shell script to your path. You’ll want the run-docker-kube-for-mac.sh in your path. For example:
CloudraticSolutionsLLCs-MacBook-Pro:kube-for-mac l.abruce$ ls -la ~/bin/run-docker-kube-for-mac.sh
lrwxr-xr-x 1 l.abruce staff 109 May 3 09:15 /Users/l.abruce/bin/run-docker-kube-for-mac.sh -> /Users/l.abruce/proj/git/src/github.com/streamplace/run-docker-kube-for-mac.sh

# Start the cluster.

Make sure you are in the kube-for-mac folder (you pulled this down from github).

Start the cluster:

./lcl-k8s4m.sh start

Output will resemble:

Starting kube-for-mac...
docker run --privileged -v /:/rootfs -v /Users:/Users \
  --volume /Users/l.abruce/proj/git/lmgitlab.hlsdev.local/hlsdev/docker-images/kube-for-mac/hacks/v1.6.3:/etc/hacks-in:ro \
  -d --name lm-docker-kube-for-mac-start \
  -e DOCKER_ARGS="--volume /etc/hacks/v1.6.3/kubelet/etc/kubernetes/manifests/master.json:/etc/kubernetes/manifests/master.json:ro" \
  -e K8S_VERSION=1.6.3 \
  -e KUBELET_ARGS="--cgroups-per-qos=false --enforce-node-allocatable=""" \
  -e K8S_HACKS="/etc/hacks-in/hacks.sh" \
  dockerregistry.hlsdev.local:5000/hlsdev/kube-for-mac:latest
4165b038f8086f548d8128f0b684061b6a19ec88eeff423186b879519c0d0e5b
Wait for start: .OK
Wait for server: ..OK

# Verify the cluster.

First, get namespaces:

CloudraticSolutionsLLCs-MacBook-Pro:kube-for-mac l.abruce$ kubectl get ns
NAME          STATUS    AGE
default       Active    28s
kube-public   Active    27s
kube-system   Active    28s

Verify the pods:

CloudraticSolutionsLLCs-MacBook-Pro:kube-for-mac l.abruce$ kubectl --namespace=kube-system get pods
NAME                                    READY     STATUS    RESTARTS   AGE
k8s-etcd-127.0.0.1                      1/1       Running   0          43s
k8s-master-127.0.0.1                    4/4       Running   1          43s
kube-addon-manager-127.0.0.1            2/2       Running   0          43s
kube-dns-806549836-wgx9j                3/3       Running   0          41s
kubernetes-dashboard-2917854236-9vkr9   1/1       Running   0          42s

Start a sample pod:

kubectl run -i -t busybox --image=busybox --restart=Never

Now verify DNS works and exit:

/ # nslookup kubernetes
Server:    10.0.0.10
Address 1: 10.0.0.10 kube-dns.kube-system.svc.cluster.local

Name:      kubernetes
Address 1: 10.0.0.1 kubernetes.default.svc.cluster.local
/ # exit

# Terminate the cluster. Simply use the analogous stop command:

./lcl-k8s4m.sh stop

Output should resemble:

Stopping kube-for-mac...
docker run --privileged -v /:/rootfs -v /Users:/Users \
  --volume /Users/l.abruce/proj/git/lmgitlab.hlsdev.local/hlsdev/docker-images/kube-for-mac/hacks/v1.6.3:/etc/hacks-in:ro \
  -d --name lm-docker-kube-for-mac-stop \
  -e K8S_VERSION=1.6.3 \
  -e K8S_HACKS="/etc/hacks-in/hacks.sh" \
  dockerregistry.hlsdev.local:5000/hlsdev/kube-for-mac:latest stop
d0d0fb33b26b971dd405e2db5a6f857e4d498f528277d5602b26892a2ef11e7c
Wait for stop: ..........OK

>>>>>>>  Deleting Kubernetes cluster...
kubelet
k8s-proxy-1
k8s-proxy-2

>>>>>>>  Deleting all kubernetes containers...
k8s_busybox_busybox_default_6827e94d-3a49-11e7-962d-ba4b3ade41c6_0
k8s_POD_busybox_default_6827e94d-3a49-11e7-962d-ba4b3ade41c6_0
k8s_sidecar_kube-dns-806549836-wgx9j_kube-system_3c128f2d-3a49-11e7-962d-ba4b3ade41c6_0
k8s_dnsmasq_kube-dns-806549836-wgx9j_kube-system_3c128f2d-3a49-11e7-962d-ba4b3ade41c6_0
k8s_kubedns_kube-dns-806549836-wgx9j_kube-system_3c128f2d-3a49-11e7-962d-ba4b3ade41c6_0
k8s_kubernetes-dashboard_kubernetes-dashboard-2917854236-9vkr9_kube-system_3b5b66aa-3a49-11e7-962d-ba4b3ade41c6_0
k8s_POD_kube-dns-806549836-wgx9j_kube-system_3c128f2d-3a49-11e7-962d-ba4b3ade41c6_0
k8s_POD_kubernetes-dashboard-2917854236-9vkr9_kube-system_3b5b66aa-3a49-11e7-962d-ba4b3ade41c6_0
k8s_apiserver_k8s-master-127.0.0.1_kube-system_46406242b8e4a9b7dee0f580bce8311d_1
k8s_setup_k8s-master-127.0.0.1_kube-system_46406242b8e4a9b7dee0f580bce8311d_0
k8s_scheduler_k8s-master-127.0.0.1_kube-system_46406242b8e4a9b7dee0f580bce8311d_0
k8s_apiserver_k8s-master-127.0.0.1_kube-system_46406242b8e4a9b7dee0f580bce8311d_0
k8s_kube-addon-manager-data_kube-addon-manager-127.0.0.1_kube-system_6d93f1030e8e9e6e27f07f918bada68b_0
k8s_etcd_k8s-etcd-127.0.0.1_kube-system_ce41cb65bfba8d0e5f2575acaa3816ca_0
k8s_controller-manager_k8s-master-127.0.0.1_kube-system_46406242b8e4a9b7dee0f580bce8311d_0
k8s_kube-addon-manager_kube-addon-manager-127.0.0.1_kube-system_6d93f1030e8e9e6e27f07f918bada68b_0
k8s_kube-proxy_k8s-proxy-127.0.0.1_kube-system_d00ccc45519f37e0b496f8ba2ebc1354_0
k8s_POD_k8s-etcd-127.0.0.1_kube-system_ce41cb65bfba8d0e5f2575acaa3816ca_0
k8s_POD_k8s-master-127.0.0.1_kube-system_46406242b8e4a9b7dee0f580bce8311d_0
k8s_POD_kube-addon-manager-127.0.0.1_kube-system_6d93f1030e8e9e6e27f07f918bada68b_0
k8s_POD_k8s-proxy-127.0.0.1_kube-system_d00ccc45519f37e0b496f8ba2ebc1354_0

>>>>>>>  Deleting kube-for-mac startup container...
dockerregistry.hlsdev.local:5000/hlsdev/kube-for-mac:latest
4165b038f808

>>>>>>>  Removing all kubelet mounts

>>>>>>>  Removing /var/lib/kubelet

>>>>>>>  Executing hack: '/etc/hacks-in/hacks.sh'
Cleanup Docker Alpine folder...
Remove our specific hacks folder...

That is all.

Team-oriented systems mentor with deep knowledge of numerous software methodologies, technologies, languages, and operating systems. Excited about turning emerging technology into working production-ready systems. Focused on moving software teams to a higher level of world-class application development. Specialties:Software analysis and development...Product management through the entire lifecycle...Discrete product integration specialist!

Leave a Reply

Your email address will not be published. Required fields are marked *

*