Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #88 from TheNewNormal/v0.4.5
Browse files Browse the repository at this point in the history
V0.4.5
  • Loading branch information
rimusz authored Jul 22, 2016
2 parents 15b12a1 + d881941 commit b2705ff
Show file tree
Hide file tree
Showing 36 changed files with 219 additions and 414 deletions.
85 changes: 54 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Kubernetes Cluster for macOS
Easy Kubernetes Cluster for macOS
============================
![k8s-multinode](k8s-multinode.png)

Expand All @@ -24,13 +24,23 @@ How to install Kube-Cluster
-----------
- **macOS 10.10.3** Yosemite or later
- Mac 2010 or later for this to work
- [Corectl App](https://github.com/TheNewNormal/corectl.app) is installed
- **Note:** For the fresh install it is recommended to restart your Mac if you have used VirtualBox based VM, as the VirtualBox sometimes messes up networking.
- **Note:** [Corectl App](https://github.com/TheNewNormal/corectl.app) must be installed, which will serve as `corectld` server daemon control.


###Install:

Open downloaded `dmg` file and drag the App e.g. to your Desktop. Start the `Kube-Cluster` and `Initial setup of Kube-Cluster VMs` will run.
- Download [Corectl App](https://github.com/TheNewNormal/corectl.app) `latest dmg` from the [Releases Page](https://github.com/TheNewNormal/corectl.app/releases) and install it to `/Applications` folder, it allows to start/stop/update [corectl](https://github.com/TheNewNormal/corectl) tools needed to run CoreOS VMs on macOS
- Open downloaded `dmg` file and drag the App e.g. to your Desktop. Start the `Kube-Cluster` and `Initial setup of Kube-Cluster VMs` will run, then follow the instructions there.

**TL;DR**

- App's files are installed to `~/kube-solo` folder
- App will bootstrap `master+worker` Kubernetes cluster on the single VM
- Mac user home folder can be enabled via `Setup\Enable shared NFS user home folder` to automaticly mounted to VM: `/Users/my_user`:`/Users/my_user` on each VM boot
- macOS `docker` client is installed to `~/kube-solo/bin` and preset in `OS shell` to be used from there, so you can build `docker` images on the VM and use with Kubernetes


**The install will do the following:**

* All dependent files/folders will be put under `kube-cluster` folder in the user's home folder e.g `/Users/someuser/kube-cluster`
* user-data file will have fleet, etcd and flannel set
Expand All @@ -41,13 +51,15 @@ Open downloaded `dmg` file and drag the App e.g. to your Desktop. Start the `Kub
* [Fleet-UI](http://fleetui.com) via unit file will be installed to check running fleet units
* [Kubernetes Dashboard](http://kubernetes.io/docs/user-guide/ui/), [DNS](https://github.com/kubernetes/kubernetes/blob/release-1.2/cluster/addons/dns/README.md) and [Kubedash](https://github.com/kubernetes/kubedash) will be instlled as add-ons
* Via assigned static IPs (which will be shown on first boot and will survive VMs reboots) you can access any port on any CoreOS VM
* Persistent disks `xxx-data.img` will be created and mounted to VMs `/data` for these mount binds:
* Persistent sparse disks (QCow2) `xxx-data.img` will be created and mounted to VMs as `/data` for these mount binds and other folders:

```
/data/var/lib/docker -> /var/lib/docker
/data/var/lib/rkt -> /var/lib/rkt
/data/var/lib/etcd2 -> /var/lib/etcd2
/data/opt/bin -> /opt/bin
/var/lib/kubelet sym linked to /data/kubelet
/data/opt/bin
/data/var/lib/etcd2
/data/kubernetes
```

How it works
Expand All @@ -62,7 +74,7 @@ Just start `Kube-Cluster` application and you will find a small icon with the Ku
2) etcd endpoint - export ETCDCTL_PEERS=http://192.168.64.xxx:2379
3) fleetctl endpoint - export FLEETCTL_ENDPOINT=http://192.168.64.xxx:2379
4) fleetctl driver - export FLEETCTL_DRIVER=etcd
5) Path to ~/kube-cluster/bin where fleetctl, helmc and kubectl are stored
5) Path to ~/kube-cluster/bin where fleetctl, helmc, deis and kubectl are stored
````

* `Updates/Update Kubernetes to latest stable version` will update to latest stable version of Kubernetes.
Expand All @@ -77,33 +89,44 @@ Just start `Kube-Cluster` application and you will find a small icon with the Ku
Example ouput of succesfull CoreOS + Kubernetes cluster install:

````
$
etcd cluster:
/registry
/coreos.com
fleetctl list-units:
UNIT MACHINE ACTIVE SUB
fleet-ui.service 78ea6428.../192.168.64.5 active running
kube-apiserver.service 78ea6428.../192.168.64.5 active running
kube-controller-manager.service 78ea6428.../192.168.64.5 active running
kube-scheduler.service 78ea6428.../192.168.64.5 active running
kube-kubelet.service 1d00e269.../192.168.64.6 active running
kube-kubelet.service de9127a5.../192.168.64.7 active running
kube-proxy.service 1d00e269.../192.168.64.6 active running
kube-proxy.service de9127a5.../192.168.64.7 active running
fleetctl list-machines:
MACHINE IP METADATA
9b88a46c... 192.168.64.3 role=node
d0c68677... 192.168.64.4 role=node
f93b555e... 192.168.64.2 role=control
Waiting for Kubernetes cluster to be ready. This can take a few minutes...
\...
fleetctl list-units:
UNIT MACHINE ACTIVE SUB
fleet-ui.service f93b555e.../192.168.64.2 active running
kube-apiserver.service f93b555e.../192.168.64.2 active running
kube-controller-manager.service f93b555e.../192.168.64.2 active running
kube-kubelet.service 9b88a46c.../192.168.64.3 active running
kube-kubelet.service d0c68677.../192.168.64.4 active running
kube-proxy.service 9b88a46c.../192.168.64.3 active running
kube-proxy.service d0c68677.../192.168.64.4 active running
kube-scheduler.service f93b555e.../192.168.64.2 active running
Waiting for Kubernetes nodes to be ready. This can take a bit...
-...
kubectl get nodes:
NAME LABELS STATUS AGE
192.168.64.8 kubernetes.io/hostname=k8snode-01,node=worker1 Ready 1h
192.168.64.9 kubernetes.io/hostname=k8snode-02,node=worker2 Ready 1h
node "k8snode-01" labeled
node "k8snode-02" labeled
Creating kube-system namespace ...
Installing SkyDNS ...
replicationcontroller "kube-dns-v17" created
service "kube-dns" created
Installing Kubernetes UI ...
replicationcontroller "kubernetes-dashboard-v1.1.0" created
service "kubernetes-dashboard" created
Installing Kubedash ...
deployment "kubedash" created
service "kubedash" created
kubectl get nodes:
NAME STATUS AGE
k8snode-01 Ready 6s
k8snode-02 Ready 6s
````


Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/Kube-Cluster/Kube-Cluster-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.4.4</string>
<string>0.4.5</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>165</string>
<string>181</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion src/Kube-Cluster/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"SetupAlertInformativeText" = " 'Initial setup of Kube-Cluster' at any time later one !!! ";
"HomeFolderExistsAlertInformativeText" = "Folder %@ exists, please delete or rename that folder !!!";
"AboutAlertMessage" = "Kube-Cluster for macOS v%@";
"AboutInformativeText" = "It is a simple wrapper around corectl + CoreOS VM, which allows to control Kube-Cluster via Status Bar !!!";
"AboutInformativeText" = "It is a simple wrapper around corectl + CoreOS VMs, which allows to control Kube-Cluster via Status Bar !!!";
"DmgAlertMessage" = "Kube Cluster App cannot be started from DMG !!!";
"DmgAlertInformativeText" = "Please copy the App e.g. to your Applications folder ...";
"CorectlAppAlertMessage" = "Kube Cluster App cannot start !!!";
Expand Down
41 changes: 10 additions & 31 deletions src/cloud-init/user-data.master
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ coreos:
reboot-strategy: off
etcd2:
name: k8smaster-01
data-dir: /data/var/lib/etcd2
initial-cluster-token: k8s_etcd
initial-cluster-state: new
initial-advertise-peer-urls: http://k8smaster-01:2380
Expand Down Expand Up @@ -39,13 +40,13 @@ coreos:
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c '/usr/sbin/blkid -pi /dev/vda | grep TYPE= || /usr/sbin/mkfs.ext4 -i 8192 /dev/vda'
ExecStart=/bin/sh -c '/usr/sbin/blkid -pi /dev/vda | grep TYPE= || /usr/sbin/mkfs.ext4 -i 8192 -L k8s_data /dev/vda'
- name: data.mount
command: start
content: |
[Unit]
Description=Mounts ephemeral to /data
Requires=format-persistent-disk.service
Requires=format-persistent-disk.service etcd2.service fleet.service docker.service rkt-metadata.socket
After=format-persistent-disk.service
Before=etcd2.service fleet.service docker.service rkt-metadata.socket
[Mount]
Expand All @@ -62,26 +63,13 @@ coreos:
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c '[[ -d /data/var/lib/etcd2 ]] || mkdir -p /data/var/lib/etcd2 && /usr/bin/chown etcd:etcd /data/var/lib/etcd2'
ExecStart=/bin/sh -c '/usr/bin/chown etcd:etcd /data/var/lib/etcd2'
ExecStart=/bin/sh -c '[[ -d /data/var/lib/docker ]] || mkdir -p /data/var/lib/docker'
ExecStart=/bin/sh -c '[[ -d /data/var/lib/rkt ]] || mkdir -p /data/var/lib/rkt && /usr/bin/chown root:rkt /data/var/lib/rkt && /usr/bin/chmod g+s /data/var/lib/rkt'
ExecStart=/bin/sh -c '[[ -d /data/var/lib/etcd2 ]] || mkdir -p /data/var/lib/etcd2 && /usr/bin/chown etcd:etcd /data/var/lib/etcd2'
ExecStart=/bin/sh -c '/usr/bin/chown root:rkt /data/var/lib/rkt && /usr/bin/chmod g+s /data/var/lib/rkt'
ExecStart=/bin/sh -c '[[ -d /data/opt/bin ]] || mkdir -p /data/opt/bin'
ExecStart=/bin/sh -c '[[ -d /data/kubernetes ]] || mkdir -p /data/kubernetes'
ExecStart=/bin/sh -c '/usr/bin/chown root:rkt /data/var/lib/rkt && /usr/bin/chmod g+s /data/var/lib/rkt'
ExecStart=/bin/sh -c '/usr/bin/chown etcd:etcd /data/var/lib/etcd2'
- name: var-lib-etcd2.mount
command: start
content: |
[Unit]
Description=Binds /data/var/lib/etcd2 to /var/lib/etcd2
After=persistent-data-checks.service
Requires=persistent-data-checks docker.service etcd2.service
Before=etcd2.service
[Mount]
What=/data/var/lib/etcd2
Where=/var/lib/etcd2
Type=none
Options=bind
- name: var-lib-docker.mount
command: start
content: |
Expand All @@ -95,6 +83,8 @@ coreos:
Where=/var/lib/docker
Type=none
Options=bind
[Install]
RequiredBy=docker.service
- name: var-lib-rkt.mount
command: start
content: |
Expand All @@ -108,19 +98,8 @@ coreos:
Where=/var/lib/rkt
Type=none
Options=bind
- name: opt-bin.mount
command: start
content: |
[Unit]
Description=Binds /data/opt/bin to /opt/bin
Requires=persistent-data-checks.service
After=persistent-data-checks.service
Before=docker.service rkt-metadata.socket
[Mount]
What=/data/opt/bin
Where=/opt/bin
Type=none
Options=bind
[Install]
RequiredBy=rkt-metadata.socket
- name: etcd2.service
command: start
- name: fleet.service
Expand Down
72 changes: 12 additions & 60 deletions src/cloud-init/user-data.node1 → src/cloud-init/user-data.node
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#cloud-config

hostname: k8snode-01

coreos:
update:
reboot-strategy: off
etcd2:
data-dir: /data/var/lib/etcd2
listen-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
advertise-client-urls: http://0.0.0.0:2379,http://0.0.0.0:4001
initial-cluster: k8smaster-01=http://k8smaster-01:2380
Expand Down Expand Up @@ -35,13 +34,13 @@ coreos:
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c '/usr/sbin/blkid -pi /dev/vda | grep TYPE= || /usr/sbin/mkfs.ext4 -i 8192 /dev/vda'
ExecStart=/bin/sh -c '/usr/sbin/blkid -pi /dev/vda | grep TYPE= || /usr/sbin/mkfs.ext4 -i 8192 -L k8s_data /dev/vda'
- name: data.mount
command: start
content: |
[Unit]
Description=Mounts ephemeral to /data
Requires=format-persistent-disk.service
Requires=format-persistent-disk.service etcd2.service fleet.service docker.service rkt-metadata.socket
After=format-persistent-disk.service
Before=etcd2.service fleet.service docker.service rkt-metadata.socket
[Mount]
Expand All @@ -58,27 +57,15 @@ coreos:
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c '[[ -d /data/var/lib/etcd2 ]] || mkdir -p /data/var/lib/etcd2 && /usr/bin/chown etcd:etcd /data/var/lib/etcd2'
ExecStart=/bin/sh -c '/usr/bin/chown etcd:etcd /data/var/lib/etcd2'
ExecStart=/bin/sh -c '[[ -d /data/var/lib/docker ]] || mkdir -p /data/var/lib/docker'
ExecStart=/bin/sh -c '[[ -d /data/var/lib/rkt ]] || mkdir -p /data/var/lib/rkt && /usr/bin/chown root:rkt /data/var/lib/rkt && /usr/bin/chmod g+s /data/var/lib/rkt'
ExecStart=/bin/sh -c '[[ -d /data/var/lib/etcd2 ]] || mkdir -p /data/var/lib/etcd2 && /usr/bin/chown etcd:etcd /data/var/lib/etcd2'
ExecStart=/bin/sh -c '/usr/bin/chown root:rkt /data/var/lib/rkt && /usr/bin/chmod g+s /data/var/lib/rkt'
ExecStart=/bin/sh -c '[[ -d /data/opt/bin ]] || mkdir -p /data/opt/bin'
ExecStart=/bin/sh -c '[[ -d /data/kubernetes/manifests ]] || mkdir -p /data/kubernetes/manifests'
ExecStart=/bin/sh -c '[[ -d /data/kubelet ]] || mkdir -p /data/kubelet'
ExecStart=/bin/sh -c '[[ -d /data/mnt ]] || mkdir -p /data/mnt'
ExecStart=/bin/sh -c '/usr/bin/chown root:rkt /data/var/lib/rkt && /usr/bin/chmod g+s /data/var/lib/rkt'
ExecStart=/bin/sh -c '/usr/bin/chown etcd:etcd /data/var/lib/etcd2'
- name: var-lib-etcd2.mount
command: start
content: |
[Unit]
Description=Binds /data/var/lib/etcd2 to /var/lib/etcd2
After=persistent-data-checks.service
Requires=persistent-data-checks docker.service etcd2.service
Before=etcd2.service
[Mount]
What=/data/var/lib/etcd2
Where=/var/lib/etcd2
Type=none
Options=bind
ExecStart=/bin/sh -c 'sudo ln -s /data/kubelet /var/lib/kubelet'
- name: var-lib-docker.mount
command: start
content: |
Expand All @@ -92,6 +79,8 @@ coreos:
Where=/var/lib/docker
Type=none
Options=bind
[Install]
RequiredBy=docker.service
- name: var-lib-rkt.mount
command: start
content: |
Expand All @@ -105,45 +94,8 @@ coreos:
Where=/var/lib/rkt
Type=none
Options=bind
- name: opt-bin.mount
command: start
content: |
[Unit]
Description=Binds /data/opt/bin to /opt/bin
Requires=persistent-data-checks.service
After=persistent-data-checks.service
Before=docker.service rkt-metadata.socket
[Mount]
What=/data/opt/bin
Where=/opt/bin
Type=none
Options=bind
- name: var-lib-kubelet.mount
command: start
content: |
[Unit]
Description=Binds /data/kubelet to /var/lib/kubelet
Requires=persistent-data-checks.service
After=persistent-data-checks.service
Before=docker.service rkt-metadata.socket
[Mount]
What=/data/kubelet
Where=/var/lib/kubelet
Type=none
Options=bind
- name: mnt.mount
command: start
content: |
[Unit]
Description=Binds /data/mnt to /mnt
Requires=persistent-data-checks.service
After=persistent-data-checks.service
Before=docker.service rkt-metadata.socket
[Mount]
What=/data/mnt
Where=/mnt
Type=none
Options=bind
[Install]
RequiredBy=rkt-metadata.socket
- name: etcd2.service
command: start
- name: fleet.service
Expand Down
Loading

0 comments on commit b2705ff

Please sign in to comment.