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 #105 from TheNewNormal/v0.5.2
Browse files Browse the repository at this point in the history
V0.5.2
  • Loading branch information
rimusz authored Oct 24, 2016
2 parents 96a87c7 + 197171e commit ad81b8c
Show file tree
Hide file tree
Showing 16 changed files with 124 additions and 35 deletions.
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Easy Kubernetes Cluster for macOS

It leverages **macOS native Hypervisor virtualisation framework** of using [corectl](https://github.com/TheNewNormal/corectl) command line tool, so there are no needs to use VirtualBox or any other virtualisation software anymore.

**Includes:** [Helm Classic](https://helm.sh) - The Kubernetes Package Manager and an option from shell to install [Deis Workflow](https://deis.com) on top of Kubernetes: `$ install_deis`
**Includes:** [Helm Classic](https://helm.sh) / [Helm v2](https://github.com/kubernetes/helm) - The Kubernetes Package Manager and an option from shell to install [Deis Workflow](https://deis.com) on top of Kubernetes: `$ install_deis`

**Kube-Cluster App** can be used together with [CoreOS VM App](https://github.com/TheNewNormal/coreos-osx) which allows to build Docker containers and both apps have access to the same local Docker registry hosted by [Corectl App](https://github.com/TheNewNormal/corectl.app).

Expand Down Expand Up @@ -49,10 +49,10 @@ How to install Kube-Cluster
* user-data file will have fleet, etcd and flannel set
* Will download latest CoreOS ISO image (if there is no such) and run `corectl` to initialise VM
* When you first time do install or 'Up' after destroying Kube-Cluster setup, k8s binary files (with the version which was available when the App was built) get copied to CoreOS VMs, this speeds up Kubernetes cluster setup.
* It will install `fleetctl, kubectl, helmc and deis` clients to `~/kube-cluster/bin/`
* It will install `fleetctl, kubectl, helm and deis` clients to `~/kube-cluster/bin/`
* Kubernetes services will be installed with fleet units which are placed in `~/kube-cluster/fleet`, this allows very easy updates to fleet units if needed.
* [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/tree/master/cluster/addons/dns) and [Kubedash](https://github.com/kubernetes/kubedash) will be instlled as add-ons
* [Kubernetes Dashboard](http://kubernetes.io/docs/user-guide/ui/) and [DNS](https://github.com/kubernetes/kubernetes/tree/master/cluster/addons/dns) 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 sparse disks (QCow2) `xxx-data.img` will be created and mounted to VMs as `/data` for these mount binds and other folders:

Expand Down Expand Up @@ -86,7 +86,6 @@ Just start `Kube-Cluster` application and you will find a small icon with the Ku
* `SSH to k8smaster01 and k8snode-01/02` menu options will open VMs shell
* [Fleet-UI](http://fleetui.com) dashboard will show running fleet units and etc
* [Kubernetes Dashboard](http://kubernetes.io/docs/user-guide/ui/) will show nice Kubernetes Dashboard, where you can check Nodes, Pods, Replication, Deployments, Service Controllers, deploy Apps and etc.
* [Kubedash](https://github.com/kubernetes/kubedash) is a performance analytics UI for Kubernetes Clusters


Example ouput of succesfull CoreOS + Kubernetes cluster install:
Expand Down Expand Up @@ -118,14 +117,10 @@ Installing SkyDNS ...
replicationcontroller "kube-dns-v17" created
service "kube-dns" created
Installing Kubernetes UI ...
replicationcontroller "kubernetes-dashboard-v1.1.0" created
Installing Kubernetes Dashboard ...
Deployment "kubernetes-dashboard-v1.4.0" created
service "kubernetes-dashboard" created
Installing Kubedash ...
deployment "kubedash" created
service "kubedash" created
kubectl get nodes:
NAME STATUS AGE
k8snode-01 Ready 6s
Expand All @@ -134,7 +129,6 @@ k8snode-02 Ready 6s




Usage
------------

Expand Down
Binary file modified kube-cluster-osx.png
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/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="16B2327e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="16B2553a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
</dependencies>
Expand Down Expand Up @@ -694,7 +694,7 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="Um0-uP-0o3"/>
<menuItem title="Update macOS fleetctl, helmc and deis clients" id="KSz-fW-Vbe">
<menuItem title="Update macOS fleetctl, helm and deis clients" id="KSz-fW-Vbe">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="updates:" target="494" id="Zus-fv-0H4"/>
Expand Down
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.5.1</string>
<string>0.5.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>201</string>
<string>203</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
13 changes: 7 additions & 6 deletions src/bin/install_deis
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ helmc fetch deis/workflow-${WORKFLOW_RELEASE} workflow-${WORKFLOW_RELEASE}-kube-
helmc generate -x manifests workflow-${WORKFLOW_RELEASE}-kube-cluster

# pin router to node worker1
echo " nodeSelector:" >> ~/.helmc/workspace/charts/workflow-${WORKFLOW_RELEASE}-kube-cluster/manifests/deis-router-rc.yaml
echo " node: worker1" >> ~/.helmc/workspace/charts/workflow-${WORKFLOW_RELEASE}-kube-cluster/manifests/deis-router-rc.yaml
echo " nodeSelector:" >> ~/.helmc/workspace/charts/workflow-${WORKFLOW_RELEASE}-kube-cluster/manifests/deis-router-deployment.yaml
echo " node: worker1" >> ~/.helmc/workspace/charts/workflow-${WORKFLOW_RELEASE}-kube-cluster/manifests/deis-router-deployment.yaml

# update minio RC with persistent volume
# update minio Deployment with persistent volume
cp "${res_folder}"/deis/* ~/.helmc/workspace/charts/workflow-${WORKFLOW_RELEASE}-kube-cluster/manifests
#
cd ~/.helmc/workspace/charts/workflow-${WORKFLOW_RELEASE}-kube-cluster/manifests
"${res_folder}"/bin/gsed -i '/readOnly: true/ r deis-minio-rc-1.txt' deis-minio-rc.yaml
cat deis-minio-rc-2.txt >> deis-minio-rc.yaml
"${res_folder}"/bin/gsed -i '/readOnly: true/ r deis-minio-ds-1.txt' deis-minio-deployment.yaml
cat deis-minio-ds-2.txt >> deis-minio-deployment.yaml
rm -f *.txt

# Install Deis PaaS
Expand Down Expand Up @@ -83,8 +83,9 @@ until kubectl --namespace=deis get po | grep [d]eis-logger- | grep "1/1" >/dev/
until kubectl --namespace=deis get po | grep [d]eis-database- | grep "1/1" >/dev/null 2>&1; do i=$(( (i+1) %4 )); printf "\r${spin:$i:1}"; sleep .1; done
until kubectl --namespace=deis get po | grep [d]eis-router- | grep "1/1" >/dev/null 2>&1; do i=$(( (i+1) %4 )); printf "\r${spin:$i:1}"; sleep .1; done
until kubectl --namespace=deis get po | grep [d]eis-controller- | grep "1/1" >/dev/null 2>&1; do i=$(( (i+1) %4 )); printf "\r${spin:$i:1}"; sleep .1; done
sleep 10
until kubectl --namespace=deis get po | grep [d]eis-controller- | grep "1/1" >/dev/null 2>&1; do i=$(( (i+1) %4 )); printf "\r${spin:$i:1}"; sleep .1; done
#

sleep 10

echo " "
Expand Down
File renamed without changes.
File renamed without changes.
19 changes: 12 additions & 7 deletions src/first-init.command
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ install_k8s_files
echo " "
#

# download latest version of fleetctl and helmc clients
download_osx_clients
#

# set etcd endpoint
export ETCDCTL_PEERS=http://$master_vm_ip:2379

Expand Down Expand Up @@ -87,6 +83,11 @@ echo "Generating kubeconfig file ..."
# set kubernetes master
export KUBERNETES_MASTER=http://$master_vm_ip:8080
#
# set kubernetes cluster config file path for Helm
export KUBECONFIG=~/kube-cluster/kube/kubeconfig
export HELM_HOST=$node2_vm_ip:32767

# wait for Kubernetes cluster readiness
echo " "
echo "Waiting for Kubernetes cluster to be ready. This can take a few minutes..."
spin='-\|/'
Expand All @@ -104,12 +105,16 @@ until ~/kube-cluster/bin/kubectl get nodes | grep -w "k8snode-02" | grep -w "Rea
echo "..."
echo " "
#
install_k8s_add_ons
#
# attach label to the nodes
~/kube-cluster/bin/kubectl label nodes k8snode-01 node=worker1
~/kube-cluster/bin/kubectl label nodes k8snode-02 node=worker2
#
install_k8s_add_ons
#
# download latest version of deis, helmc and helm clients
# install Helm Tiller
download_osx_clients

# remove unfinished_setup file
rm -f ~/kube-cluster/logs/unfinished_setup > /dev/null 2>&1
#
Expand Down Expand Up @@ -137,7 +142,7 @@ echo " "
echo "You can control this App via status bar icon... "
echo " "

echo "Also you can install Deis Workflow PaaS (https://deis.com) with 'install_deis' command ..."
echo "Also you can install Deis Workflow PaaS (https://deis.com/workflow) with 'install_deis' command ..."
echo " "

cd ~/kube-cluster
Expand Down
55 changes: 54 additions & 1 deletion src/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ sleep 1


function download_osx_clients() {

# download fleetctl file
FLEETCTL_VERSION=$(~/bin/corectl ssh k8smaster-01 'fleetctl --version' | awk '{print $3}' | tr -d '\r')
FILE=fleetctl
Expand Down Expand Up @@ -348,8 +349,53 @@ else
fi
fi

# get lastest macOS helm cli version
echo " "
echo "Checking for latest Helm version..."
cd ~/kube-cluster/tmp
LATEST_HELM=$(curl -s https://api.github.com/repos/kubernetes/helm/releases/latest | grep "tag_name" | awk '{print $2}' | sed -e 's/"\(.*\)"./\1/')

# check if the binary exists
if [ ! -f ~/kube-cluster/bin/helm ]; then
INSTALLED_HELM=v0.0.0
else
INSTALLED_HELM=$(~/kube-cluster/bin/helm version)
fi

#
MATCH=$(echo "${INSTALLED_HELM}" | grep -c "${LATEST_HELM}")
if [ $MATCH -ne 0 ]; then
echo " "
echo "Helm is up to date !!!"
else
echo " "
echo "Downloading latest ${LATEST_HELM} of 'helm' cli for macOS"
curl -k -L http://storage.googleapis.com/kubernetes-helm/helm-${LATEST_HELM}-darwin-amd64.tar.gz > helm.tar.gz
tar xvf helm.tar.gz -C ~/kube-cluster/tmp --strip=1 darwin-amd64/helm > /dev/null 2>&1
chmod +x helm
mv -f helm ~/kube-cluster/bin/helm
rm -f helm.tar.gz
echo " "
echo "Installed latest ${LATEST_HELM} of 'helm' cli to ~/kube-cluster/bin ..."
echo " "
# get VM's IP
vm_ip=$(~/bin/corectl q -i k8snode-02)
# Set the shell environment variables
# set kubernetes master endpoint
export KUBERNETES_MASTER=http://$vm_ip:8080
# set kubernetes cluster config file path for Helm
export KUBECONFIG=~/kube-cluster/kube/kubeconfig
export HELM_HOST=$vm_ip:32767
echo "Installing new version of Helm Tiller..."
kubectl --namespace=kube-system delete deployment tiller-deploy > /dev/null 2>&1
~/kube-cluster/bin/helm init
echo "Helm is ready to sail ..."
fi
#

# get lastest macOS helmc cli version
cd ~/kube-cluster/bin
echo " "
echo "Downloading latest version of helmc cli for macOS"
curl -o helmc https://storage.googleapis.com/helm-classic/helmc-latest-darwin-amd64
chmod +x helmc
Expand All @@ -359,6 +405,7 @@ echo "Installed latest helmc cli to ~/kube-cluster/bin ..."

# get lastest macOS deis cli version
cd ~/kube-cluster/bin
echo " "
echo "Downloading latest version of Workflow deis cli for macOS"
curl -o deis https://storage.googleapis.com/workflow-cli/deis-latest-darwin-amd64
chmod +x deis
Expand Down Expand Up @@ -587,17 +634,23 @@ echo "Installing SkyDNS ..."
~/kube-cluster/bin/kubectl create -f ~/kube-cluster/kubernetes/skydns-svc.yaml
#
echo " "
echo "Installing Kubernetes UI ..."
echo "Installing Kubernetes Dashboard ..."
~/kube-cluster/bin/kubectl create -f ~/kube-cluster/kubernetes/dashboard-controller.yaml
~/kube-cluster/bin/kubectl create -f ~/kube-cluster/kubernetes/dashboard-service.yaml
#
#
echo " "
echo "Installing Helm Tiller service ..."
~/kube-cluster/bin/kubectl create -f ~/kube-cluster/kubernetes/tiller-deploy-service.yaml
sleep 1

# clean up kubernetes folder
rm -f ~/kube-cluster/kubernetes/kube-system-ns.yaml
rm -f ~/kube-cluster/kubernetes/skydns-rc.yaml
rm -f ~/kube-cluster/kubernetes/skydns-svc.yaml
rm -f ~/kube-cluster/kubernetes/dashboard-controller.yaml
rm -f ~/kube-cluster/kubernetes/dashboard-service.yaml
rm -f ~/kube-cluster/kubernetes/tiller-deploy-service.yaml
echo " "
}

Expand Down
2 changes: 1 addition & 1 deletion src/k8s/add-ons.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# download_k8s.command
# Kube-Solo for macOS
# Kube-Cluster for macOS
#
# Created by Rimantas on 03/06/2015.
# Copyright (c) 2014 Rimantas Mocevicius. All rights reserved.
Expand Down
Binary file added src/k8s/add-ons.tgz
Binary file not shown.
18 changes: 18 additions & 0 deletions src/k8s/add-ons/tiller-deploy-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: tiller-deploy
namespace: kube-system
labels:
app: helm
name: tiller
spec:
selector:
app: helm
name: tiller
ports:
- name: tiller
port: 44134
targetPort: 44134
nodePort: 32767
type: NodePort
2 changes: 1 addition & 1 deletion src/k8s/download_dashboard.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# download_dashboard.command
# Kube-Solo for macOS
# Kube-Cluster for macOS
#
# Created by Rimantas on 03/06/2015.
# Copyright (c) 2014 Rimantas Mocevicius. All rights reserved.
Expand Down
4 changes: 2 additions & 2 deletions src/k8s/kube.tgz
Git LFS file not shown
4 changes: 2 additions & 2 deletions src/k8s/kubectl
Git LFS file not shown
18 changes: 18 additions & 0 deletions src/up.command
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ fi
echo " "
# set kubernetes master
export KUBERNETES_MASTER=http://$master_vm_ip:8080
# set kubernetes cluster config file path for Helm
export KUBECONFIG=~/kube-cluster/kube/kubeconfig
export HELM_HOST=$node2_vm_ip:32767

echo "Waiting for Kubernetes cluster to be ready. This can take a few minutes..."
spin='-\|/'
i=1
Expand All @@ -147,6 +151,20 @@ then
cp "${res_folder}"/k8s/add-ons/*.yaml ~/kube-cluster/kubernetes
install_k8s_add_ons
#
# install Helm Tiller
echo " "
echo "Installing Helm Tiller..."
~/kube-cluster/bin/helm init
#
echo " "
echo "kubectl cluster-info:"
~/kube-cluster/bin/kubectl cluster-info
echo " "
echo "Cluster version:"
CLIENT_INSTALLED_VERSION=$(~/kube-cluster/bin/kubectl version | grep "Client Version:" | awk '{print $5}' | awk -v FS='(:"|",)' '{print $2}')
SERVER_INSTALLED_VERSION=$(~/kube-cluster/bin/kubectl version | grep "Server Version:" | awk '{print $5}' | awk -v FS='(:"|",)' '{print $2}')
echo "Client version: $CLIENT_INSTALLED_VERSION"
echo "Server version: $SERVER_INSTALLED_VERSION"
# remove unfinished_setup file
rm -f ~/kube-cluster/logs/unfinished_setup > /dev/null 2>&1
fi
Expand Down

0 comments on commit ad81b8c

Please sign in to comment.