{"id":19030105,"url":"https://github.com/streamplace/kube-for-mac","last_synced_at":"2025-04-23T16:01:35.878Z","repository":{"id":138189809,"uuid":"83245586","full_name":"streamplace/kube-for-mac","owner":"streamplace","description":"Hey look, it's Kubernetes on Docker for Mac","archived":false,"fork":false,"pushed_at":"2018-01-17T00:48:00.000Z","size":62,"stargazers_count":35,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-18T01:25:05.899Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/streamplace.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-02-26T22:33:49.000Z","updated_at":"2021-05-07T06:56:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"77916529-2e11-4297-a101-22dfd37ff520","html_url":"https://github.com/streamplace/kube-for-mac","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamplace%2Fkube-for-mac","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamplace%2Fkube-for-mac/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamplace%2Fkube-for-mac/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/streamplace%2Fkube-for-mac/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/streamplace","download_url":"https://codeload.github.com/streamplace/kube-for-mac/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250468272,"owners_count":21435451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T21:16:33.362Z","updated_at":"2025-04-23T16:01:35.868Z","avatar_url":"https://github.com/streamplace.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DEPRECATED\n\n[Docker does this now](https://blog.docker.com/2018/01/docker-mac-kubernetes/). So... use that.\n\nLeaving everything else here for historical purposes.\n\n# kube-for-mac\n\nLast night I got Kubernetes running on Docker for Mac.\n\nI'm not sure if this is evil or not yet. Certainly both the Docker and Kubernetes teams tell you\nnot to do it. So. Use at your own risk. `¯\\_(ツ)_/¯`\n\n## Installing\n\nI like to start with a Docker factory reset first. Because then you know where the button is when\nthis script totally hoses your Docker VM and you need to start over.\n\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/257909/23344812/dad13f48-fc37-11e6-9e4f-ab8358d4e3ae.png\"\u003e\n\nI also like to beef up Docker's resource allocations first if I'm planning on doing anything complicated with the cluster.\n\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/257909/23344830/1634e558-fc38-11e6-94b7-e9b15a699868.png\"\u003e\n\nThen:\n\n```\ndocker run --privileged -v /:/rootfs -v /Users:/Users -d streamplace/kube-for-mac\n```\n\nBe aware that this will create ~15 Docker containers on your Docker for Mac. Because Kubernetes.\n\n## Uninstalling\n\nReboot Docker for Mac. Then:\n\n```\ndocker run --rm --privileged -v /:/rootfs streamplace/kube-for-mac stop\n```\n\nThat should delete all the Kubernetes-related stuff from the VM, while leaving the Docker VM\nintact.\n\n## Now what?\n\nBecause the Kubernetes server takes over port 8080 on the Docker VM, we can't easily forward local\nport 8080 to your local Kubernetes cluster, and we run on port 8888 instead. So you might wanna throw this in your `~/.kube/config`:\n\n```\napiVersion: v1\nclusters:\n- cluster:\n    server: http://localhost:8888\n  name: kube-for-mac\ncontexts:\n- context:\n    cluster: kube-for-mac\n    namespace: default\n    user: kube-for-mac\n  name: kube-for-mac\ncurrent-context: kube-for-mac\nkind: Config\npreferences: {}\nusers:\n- name: kube-for-mac\n```\n\n## What are these `lcl-k8s4m.sh` and `run-docker-kube-for-mac.sh` thingies?\n\nThey are handy shell scripts to fire up K8s cluster from scratch, designed to account for the ever-evolving nature of Kubernetes. (Such as 1.7.0 that no longer creates any of the manifests / addons that 1.6.x and prior versions did.)\n\nFirst, get a watcher up and running in a second window:\n```\nwatch -n 4 -d kubectl get all --all-namespaces -o wide\n```\n\nIn your first window, we want to start Kubernetes. You can use either of the two scripts above, but generally the `lcl-k8s4m.sh` script is simpler. It defaults to the latest supported Kubernetes version (v1.7.3 as of this writing).\n```\n./lcl-k8s4m.sh start\n```\n\nThat starts the whole cluster from scratch. You can watch the progress by switching to your second window and looking at Let's see a typical run:\n```\nMacBook-Pro:kube-for-mac l.abruce$ ./lcl-k8s4m.sh start\nStarting kube-for-mac...\ndocker run --privileged -v /:/rootfs -v /Users:/Users --net=host \\\n  --volume /Users/l.abruce/proj/git/src/github.com/andybrucenet/kube-for-mac/hacks/v1.7.3:/etc/hacks-in:ro \\\n  -d --name docker-kube-for-mac-start \\\n  -e DOCKER_ARGS=\"--volume /etc/hacks/v1.7.3/kubelet/etc/kubernetes/manifests:/etc/kubernetes/manifests:ro --volume /Users:/Users:rw\" \\\n  -e K8S_VERSION=1.7.3 \\\n  -e KUBELET_ARGS=\"--cgroups-per-qos=false --enforce-node-allocatable='' --cpu-cfs-quota=false\" \\\n  -e K8S_HACKS=\"/etc/hacks-in/hacks.sh\" \\\n  -e K8S_DEBUG=\"1\" \\\n  streamplace/kube-for-mac:latest\n11caf3a986aad8020121d1175f18d934253cc0b5b8bc1273f2af790ef3180960\nWait for start: .OK\nWait for server: ..OK\n\n\nWait for k8s controllers: .................OK\nDeploy DNS:\n\nRunning custom kube-for-mac...\ndocker run --rm --privileged -v /:/rootfs -v /Users:/Users --net=host \\\n  --volume /Users/l.abruce/proj/git/src/github.com/andybrucenet/kube-for-mac/hacks/v1.7.3:/etc/hacks-in:ro \\\n  -d --name docker-kube-for-mac-custom \\\n  -e DOCKER_ARGS=\"--volume /etc/hacks/v1.7.3/kubelet/etc/kubernetes/manifests:/etc/kubernetes/manifests:ro --volume /Users:/Users:rw\" \\\n  -e K8S_VERSION=1.7.3 \\\n  -e KUBELET_ARGS=\"--cgroups-per-qos=false --enforce-node-allocatable='' --cpu-cfs-quota=false\" \\\n  -e K8S_HACKS=\"/etc/hacks-in/hacks.sh\" \\\n  -e K8S_DEBUG=\"1\" \\\n  streamplace/kube-for-mac:latest custom \\\n  source /etc/hacks-in/hacks.sh DEPLOY-DNS\n3321aa3cded16fc29c7cde5df01a7f4e419f160ce7f20b1803e11d162b7068bc\n..........OK\nDeploy Dashboard:\n\nRunning custom kube-for-mac...\ndocker run --rm --privileged -v /:/rootfs -v /Users:/Users --net=host \\\n  --volume /Users/l.abruce/proj/git/src/github.com/andybrucenet/kube-for-mac/hacks/v1.7.3:/etc/hacks-in:ro \\\n  -d --name docker-kube-for-mac-custom \\\n  -e DOCKER_ARGS=\"--volume /etc/hacks/v1.7.3/kubelet/etc/kubernetes/manifests:/etc/kubernetes/manifests:ro --volume /Users:/Users:rw\" \\\n  -e K8S_VERSION=1.7.3 \\\n  -e KUBELET_ARGS=\"--cgroups-per-qos=false --enforce-node-allocatable='' --cpu-cfs-quota=false\" \\\n  -e K8S_HACKS=\"/etc/hacks-in/hacks.sh\" \\\n  -e K8S_DEBUG=\"1\" \\\n  streamplace/kube-for-mac:latest custom \\\n  source /etc/hacks-in/hacks.sh DEPLOY-DASHBOARD\n647de4a30318877ac123b92c4de1a56390f110566899581865f89694bfa49420\n.........OK\n$HELM_HOME has been configured at /Users/l.abruce/.helm.\n\nTiller (the helm server side component) has been installed into your Kubernetes Cluster.\nHappy Helming!\nWait for helm tiller: ...OK\n```\n\n### That's too much output! And what is that `helm` thing?\n\nSo there are several steps to get Kubernetes working with the v1.7.x family:\n\n* Start `kubectl` - this is the main workhorse, which spawns the API Server, ETCD Server, Scheduler..these are all the \"k8s controllers\" mentioned above.\n* Deploy DNS / Dashboard - Once the Kubernetes controller servers are run, we deploy these \"extra\" elements that make for a successful Kubernetes install. As of v1.7.x, they aren't installed automatically by the `kubectl` deployment, so we run them manually.\n* Deploy `helm` - Helm (https://github.com/kubernetes/helm) is a tool for managing Kubernetes by using \"charts\". If you have `helm` package available on your client, we will deploy it automatically to the new Kubernetes cluster. (If you do *not* have `helm` package, no worries - we just won't deploy it.) In a related project, I use `helm` to install OpenStack via containers on my local kube-for-mac!\n\nAs for the verbosity, if you would like more be sure to set the `DOCKER_KUBE_FOR_MAC_K8S_DEBUG` environment variable and we can give you more output :)\n\n### So what does it look like when I'm done?\n\nFirst, you can check out the results of your `watch ...` command above. Here's the list of deployed elements (took just a few minutes from zero-to-hero):\n```\nMacBook-Pro:poc l.abruce$ kubectl get all --all-namespaces\nNAMESPACE     NAME                                       READY     STATUS    RESTARTS   AGE\nkube-system   po/k8s-etcd-127.0.0.1                      1/1       Running   0          15m\nkube-system   po/k8s-master-127.0.0.1                    3/3       Running   0          15m\nkube-system   po/k8s-proxy-127.0.0.1                     1/1       Running   0          15m\nkube-system   po/kube-addon-manager-127.0.0.1            1/1       Running   0          15m\nkube-system   po/kube-dns-1994753994-gdjx1               3/3       Running   0          14m\nkube-system   po/kubernetes-dashboard-4062213060-v5rtl   1/1       Running   0          13m\nkube-system   po/tiller-deploy-3360264398-kkdxt          1/1       Running   0          13m\n\nNAMESPACE     NAME                       CLUSTER-IP   EXTERNAL-IP   PORT(S)         AGE\ndefault       svc/kubernetes             10.0.0.1     \u003cnone\u003e        443/TCP         16m\nkube-system   svc/kube-dns               10.0.0.10    \u003cnone\u003e        53/UDP,53/TCP   16m\nkube-system   svc/kubernetes-dashboard   10.0.0.81    \u003cnone\u003e        80/TCP          16m\nkube-system   svc/tiller-deploy          10.0.0.55    \u003cnone\u003e        44134/TCP       13m\n\nNAMESPACE     NAME                          DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE\nkube-system   deploy/kube-dns               1         1         1            1           14m\nkube-system   deploy/kubernetes-dashboard   1         1         1            1           13m\nkube-system   deploy/tiller-deploy          1         1         1            1           13m\n\nNAMESPACE     NAME                                 DESIRED   CURRENT   READY     AGE\nkube-system   rs/kube-dns-1994753994               1         1         1         14m\nkube-system   rs/kubernetes-dashboard-4062213060   1         1         1         13m\nkube-system   rs/tiller-deploy-3360264398          1         1         1         13m\n```\n\nAssuming you understand the intricacies of `kubeconfig` (https://kubernetes.io/docs/tasks/access-application-cluster/authenticate-across-clusters-kubeconfig/), you can setup your calls to default to your shiny new local cluster like we did above.\n\n### Does this actually run anything?\n\nLet's run a simple container and verify that DNS works:\n```\nMacBook-Pro:poc l.abruce$ kubectl run --rm -i -t busybox --image=busybox --restart=Never\nIf you don't see a command prompt, try pressing enter.\n/ # nslookup kubernetes\nServer:    10.0.0.10\nAddress 1: 10.0.0.10 kube-dns.kube-system.svc.cluster.local\n\nName:      kubernetes\nAddress 1: 10.0.0.1 kubernetes.default.svc.cluster.local\n/ # ping -c 1 google.com\nPING google.com (216.239.38.120): 56 data bytes\n64 bytes from 216.239.38.120: seq=0 ttl=37 time=0.612 ms\n\n--- google.com ping statistics ---\n1 packets transmitted, 1 packets received, 0% packet loss\nround-trip min/avg/max = 0.612/0.612/0.612 ms\n/ # exit\n```\n\nYou should see that the pod was killed automatically (use of the `--rm` flag to `kubectl run`).\n\n### How do I kill the cluster using the script?\n\nAlright, I'm spent. Let's kill everything:\n```\nMacBook-Pro:kube-for-mac l.abruce$ ./lcl-k8s4m.sh stop\nStopping kube-for-mac...\ndocker run --privileged -v /:/rootfs -v /Users:/Users --net=host \\\n  --volume /Users/l.abruce/proj/git/src/github.com/andybrucenet/kube-for-mac/hacks/v1.7.3:/etc/hacks-in:ro \\\n  -d --name docker-kube-for-mac-stop \\\n  -e DOCKER_ARGS=\"--volume /etc/hacks/v1.7.3/kubelet/etc/kubernetes/manifests:/etc/kubernetes/manifests:ro --volume /Users:/Users:rw\" \\\n  -e K8S_VERSION=1.7.3 \\\n  -e KUBELET_ARGS=\"--cgroups-per-qos=false --enforce-node-allocatable='' --cpu-cfs-quota=false\" \\\n  -e K8S_HACKS=\"/etc/hacks-in/hacks.sh\" \\\n  -e K8S_DEBUG=\"1\" \\\n  streamplace/kube-for-mac:latest stop\nba64f1299f15d21739402193165f5607a7be68358adb3147f030c6bbd9997e1a\nWait for stop: .......OK\n\n[...much, much cruft...]\n\nCleanup Docker Alpine folder...\nRemove our specific hacks folder...\n```\n\nYour Docker for Mac is now back to its original state. You can create another K8s cluster, or do any other work you wish.\n\nThat is all.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamplace%2Fkube-for-mac","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstreamplace%2Fkube-for-mac","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstreamplace%2Fkube-for-mac/lists"}