diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..61ba32c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +src/k8s/kube.tgz filter=lfs diff=lfs merge=lfs -text +src/k8s/kubectl filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md index 493135e..bc3a9ac 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ How to install Kube-Solo - **macOS 10.10.3** Yosemite or later - Mac 2010 or later for this to work. - **Note: [Corectl App](https://github.com/TheNewNormal/corectl.app) must be installed, which will serve as `corectld` server daemon control.** - - [iTerm2](https://www.iterm2.com/) is required, if not found the app it will install it by itself. + - [iTerm2](https://www.iterm2.com/) is required, if not found the app will install it by itself. ###Install: @@ -43,7 +43,7 @@ How to install Kube-Solo - App will bootstrap `master+worker` Kubernetes cluster on the single VM - Mac user home folder is automaticly mounted via NFS (it has to work on Mac end of course) to `/Users/my_user`:`/Users/my_user` on each VM boot, check the [PV example](https://github.com/TheNewNormal/kube-solo-osx/blob/master/examples/pv/nfs-pv-mount-on-pod.md) how to use Persistent Volumes. - 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 -- After successful install you can control `kube-solo` VM via `ksolo` cli as well. Cli resides in `~/kube-solo/bin` and `~/bin`folders and has simple commands: `ksolo start|stop|status|ip|ssh`, just add `~/bin` to your pre-set path. +- After successful install you can control `kube-solo` VM via `ksolo` cli as well. Cli resides in `~/kube-solo/bin` and `~/bin`folders and has simple commands: `ksolo start|stop|status|ip|ssh|shell`, just add `~/bin` to your pre-set path. **The install will do the following:** @@ -51,7 +51,7 @@ How to install Kube-Solo * Will download latest CoreOS ISO image (if there is no such one) and run `corectl` to initialise VM * When you first time do install or `Up` after destroying Kube-Solo setup, k8s binary files (with the version which was available when the App was built) get copied to VM, this allows to speed up Kubernetes setup. * It will install `docker, helmc, helm, deis and kubectl` clients to `~/kube-solo/bin/` -* [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 IP (it will be shown in first boot and will survive VM's reboots) you can access any port on CoreOS VM * Persistent sparse disk (QCow2) `data.img` will be created and mounted to `/data` for these mount binds and other folders: @@ -89,12 +89,11 @@ Path to `~/kube-solo/bin` where macOS clients and shell scripts are stored * `ksolo stop` will stop VM * `ksolo status`will show VM's status * `ksolo ip` will show VM's IP -* `ksolo ssh` will open VM shell - +* `ksolo ssh` will ssh to VM +* `ksolo shell` will open pre-set shell ###Other menu options: * [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 * `Check for App updates` will check for a new app version * `Updates/Update Kubernetes to the latest version` will update to latest version of Kubernetes. * `Updates/Change Kubernetes version` will download and install specified Kubernetes version from GitHub. @@ -117,8 +116,8 @@ KubeDNS is running at http://192.168.64.3:8080/api/v1/proxy/namespaces/kube-syst kubernetes-dashboard is running at http://192.168.64.3:8080/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard Cluster version: -Client version: v1.3.2 -Server version: v1.3.2 +Client version: v1.4.0 +Server version: v1.4.0 kubectl get nodes: NAME STATUS AGE diff --git a/kube-solo-osx.png b/kube-solo-osx.png index 242024f..ace2704 100644 Binary files a/kube-solo-osx.png and b/kube-solo-osx.png differ diff --git a/src/Kube-Solo.xcodeproj/project.xcworkspace/xcuserdata/rmocevicius.xcuserdatad/UserInterfaceState.xcuserstate b/src/Kube-Solo.xcodeproj/project.xcworkspace/xcuserdata/rmocevicius.xcuserdatad/UserInterfaceState.xcuserstate index fbccfea..69652f1 100644 Binary files a/src/Kube-Solo.xcodeproj/project.xcworkspace/xcuserdata/rmocevicius.xcuserdatad/UserInterfaceState.xcuserstate and b/src/Kube-Solo.xcodeproj/project.xcworkspace/xcuserdata/rmocevicius.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/src/Kube-Solo/AppDelegate.m b/src/Kube-Solo/AppDelegate.m index 6dad532..43ba467 100644 --- a/src/Kube-Solo/AppDelegate.m +++ b/src/Kube-Solo/AppDelegate.m @@ -326,22 +326,6 @@ - (IBAction)KubernetesUI:(id)sender { } } -- (IBAction)Kubedash:(id)sender { - VMStatus vmStatus = [self.vmManager checkVMStatus]; - - switch (vmStatus) { - case VMStatusDown: - [self notifyUserWithText:NSLocalizedString(@"VMStateOff", nil)]; - break; - - case VMStatusUp: { - NSString *vmIP = [NSString stringWithContentsOfURL:[NSURL ks_ipAddressURL] encoding:NSUTF8StringEncoding error:nil]; - NSString *url = [NSString stringWithFormat:@"http://%@:8080/api/v1/proxy/namespaces/kube-system/services/kubedash", vmIP]; - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]]; - break; - } - } -} - (IBAction)quit:(id)sender { VMStatus vmStatus = [self.vmManager checkVMStatus]; diff --git a/src/Kube-Solo/Base.lproj/MainMenu.xib b/src/Kube-Solo/Base.lproj/MainMenu.xib index 4158bee..7188b8b 100644 --- a/src/Kube-Solo/Base.lproj/MainMenu.xib +++ b/src/Kube-Solo/Base.lproj/MainMenu.xib @@ -1,7 +1,7 @@ - - + + - + @@ -684,12 +684,6 @@ - - - - - - diff --git a/src/Kube-Solo/Kube-Solo-Info.plist b/src/Kube-Solo/Kube-Solo-Info.plist index 9fa4394..fd2af59 100644 --- a/src/Kube-Solo/Kube-Solo-Info.plist +++ b/src/Kube-Solo/Kube-Solo-Info.plist @@ -19,11 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.5 + 0.9.6 CFBundleSignature ???? CFBundleVersion - 299 + 303 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/src/bin/install_deis b/src/bin/install_deis index 41f3ec3..f616330 100755 --- a/src/bin/install_deis +++ b/src/bin/install_deis @@ -13,9 +13,6 @@ vm_ip=$(~/bin/corectl q -i k8solo-01) # echo " " -echo "If you have installed previous versions of Deis Workflow PaaS, please uninstall it first" -echo "with '$ helmc uninstall workflow-VERSION -n deis' ..." -echo " " echo "If you want to upgrade already installed version, check out how to do upgrade at https://deis.com/docs/workflow/managing-workflow/upgrading-workflow/ " echo " " pause 'Press [Enter] key to continue...' diff --git a/src/bin/ksolo b/src/bin/ksolo index 67e9caa..2a9324a 100755 --- a/src/bin/ksolo +++ b/src/bin/ksolo @@ -9,17 +9,10 @@ start() { "${app_path}"/up.command } - -stop() { - "${app_path}"/halt.command -} - - status() { echo "$(~/bin/corectl q -a k8solo-01)" } - ip() { echo "$(~/bin/corectl q -i k8solo-01)" } @@ -28,8 +21,12 @@ ssh() { ~/bin/corectl ssh k8solo-01 } +shell() { + "${app_path}"/os_shell.command +} + usage() { - echo "Usage: ksolo start|stop|status|ip|ssh" + echo "Usage: ksolo start|stop|status|ip|ssh|shell" } @@ -49,6 +46,9 @@ case "$1" in ssh) ssh ;; + shell) + shell + ;; *) usage ;; diff --git a/src/functions.sh b/src/functions.sh index ca85976..08c7a4e 100755 --- a/src/functions.sh +++ b/src/functions.sh @@ -352,7 +352,7 @@ rm -rf ~/kube-solo/tmp/* # downloading latest version of k8s for CoreOS echo "Downloading Kubernetes $K8S_VERSION" -bins=( kubectl kubelet kube-proxy kube-apiserver kube-scheduler kube-controller-manager ) +bins=( kubelet kube-proxy kube-apiserver kube-scheduler kube-controller-manager ) for b in "${bins[@]}"; do curl -k -L https://storage.googleapis.com/kubernetes-release/release/$K8S_VERSION/bin/linux/amd64/$b > ~/kube-solo/tmp/$b done @@ -441,7 +441,7 @@ mv -f kubectl ~/kube-solo/kube chmod 755 ~/kube-solo/bin/kubectl # tar xvf kubernetes.tar.gz --strip=2 kubernetes/server/kubernetes-server-linux-amd64.tar.gz -bins=( kubectl kubelet kube-proxy kube-apiserver kube-scheduler kube-controller-manager ) +bins=( kubelet kube-proxy kube-apiserver kube-scheduler kube-controller-manager ) for b in "${bins[@]}"; do tar xvf kubernetes-server-linux-amd64.tar.gz -C ~/kube-solo/tmp --strip=3 kubernetes/server/bin/$b done @@ -472,13 +472,19 @@ vm_ip=$(~/bin/corectl q -i k8solo-01) # check if file ~/kube-solo/kube/kube.tgz exists if [ ! -f ~/kube-solo/kube/kube.tgz ] then - # copy k8s files - cp -f "${res_folder}"/k8s/kubectl ~/kube-solo/kube - chmod +x ~/kube-solo/bin/kubectl # linux binaries tar file cp -f "${res_folder}"/k8s/kube.tgz ~/kube-solo/kube fi +# check if file ~/kube-solo/bin/kubectl exists +if [ ! -f ~/kube-solo/bin/kubectl ] +then + # copy k8s files + cp -f "${res_folder}"/k8s/kubectl ~/kube-solo/bin + chmod +x ~/kube-solo/bin/kubectl + +fi + # install k8s files on to VM echo "Installing Kubernetes files on to VM..." cd ~/kube-solo/kube @@ -492,6 +498,16 @@ echo "Done..." function install_k8s_add_ons() { + +# check if file ~/kube-solo/bin/kubectl exists +if [ ! -f ~/kube-solo/bin/kubectl ] +then + # copy k8s files + cp -f "${res_folder}"/k8s/kubectl ~/kube-solo/bin + chmod +x ~/kube-solo/bin/kubectl + +fi + echo " " echo "Creating kube-system namespace ..." ~/kube-solo/bin/kubectl create -f ~/kube-solo/kubernetes/kube-system-ns.yaml > /dev/null 2>&1 @@ -503,12 +519,8 @@ echo "Installing SkyDNS ..." # echo " " echo "Installing Kubernetes Dashboard ..." -~/kube-solo/bin/kubectl create -f ~/kube-solo/kubernetes/dashboard-controller.yaml ~/kube-solo/bin/kubectl create -f ~/kube-solo/kubernetes/dashboard-service.yaml -# -echo " " -echo "Installing Kubedash ..." -~/kube-solo/bin/kubectl create -f ~/kube-solo/kubernetes/kubedash.yaml +~/kube-solo/bin/kubectl create -f ~/kube-solo/kubernetes/dashboard-controller.yaml # echo " " echo "Installing Helm Tiller service ..." @@ -522,18 +534,6 @@ rm -f ~/kube-solo/kubernetes/skydns-rc.yaml rm -f ~/kube-solo/kubernetes/skydns-svc.yaml rm -f ~/kube-solo/kubernetes/dashboard-controller.yaml rm -f ~/kube-solo/kubernetes/dashboard-service.yaml -rm -f ~/kube-solo/kubernetes/kubedash.yaml -} - - -function install_k8s_add_ons_kubelet() { -# get App's Resources folder -res_folder=$(cat ~/kube-solo/.env/resouces_path) -# -echo " " -echo "Installing add-ons: SkyDNS, Kubernetes Dashboard and Kubedash ..." -~/bin/corectl scp "${res_folder}"/k8s/add-ons.tgz k8solo-01:/home/core/ -~/bin/corectl ssh k8solo-01 'sudo tar xzf /home/core/add-ons.tgz -C /data/kubernetes/manifests' } diff --git a/src/k8s/add-ons/dashboard-controller.yaml b/src/k8s/add-ons/dashboard-controller.yaml index 1e4a7b1..28d8230 100644 --- a/src/k8s/add-ons/dashboard-controller.yaml +++ b/src/k8s/add-ons/dashboard-controller.yaml @@ -2,11 +2,11 @@ apiVersion: v1 kind: ReplicationController metadata: - name: kubernetes-dashboard-v1.1.1 + name: kubernetes-dashboard-v1.4.0 namespace: kube-system labels: k8s-app: kubernetes-dashboard - version: v1.1.1 + version: v1.4.0 kubernetes.io/cluster-service: "true" spec: replicas: 1 @@ -16,12 +16,15 @@ spec: metadata: labels: k8s-app: kubernetes-dashboard - version: v1.1.1 + version: v1.4.0 kubernetes.io/cluster-service: "true" + annotations: + scheduler.alpha.kubernetes.io/critical-pod: '' + scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]' spec: containers: - name: kubernetes-dashboard - image: gcr.io/google_containers/kubernetes-dashboard-amd64:v1.1.1 + image: gcr.io/google_containers/kubernetes-dashboard-amd64:v1.4.0 resources: # keep request = limit to keep this container in guaranteed class limits: diff --git a/src/k8s/add-ons/kubedash.yaml b/src/k8s/add-ons/kubedash.yaml deleted file mode 100644 index 8affba4..0000000 --- a/src/k8s/add-ons/kubedash.yaml +++ /dev/null @@ -1,70 +0,0 @@ ---- - apiVersion: "extensions/v1beta1" - kind: "Deployment" - metadata: - labels: - name: "kubedash" - name: "kubedash" - namespace: "kube-system" - spec: - replicas: 1 - selector: - matchLabels: - name: "kubedash" - template: - metadata: - labels: - name: "kubedash" - spec: - containers: - - image: "gcr.io/google_containers/kubedash:v0.2.1" - name: "kubedash" - command: - - "/kubedash" - - "--headless=true" - - "--heapster_url=http://localhost:8082" - resources: - limits: - cpu: 50m - memory: 100Mi - volumeMounts: - - name: "ssl-certs" - mountPath: "/etc/ssl/certs" - readOnly: true - - image: gcr.io/google_containers/heapster:v0.18.5 - name: "heapster" - resources: - limits: - cpu: 100m - memory: 300Mi - requests: - cpu: 100m - memory: 300Mi - command: - - "/heapster" - - "--source=kubernetes:''" - - "--stats_resolution=30s" - - "--sink_frequency=1m" - volumeMounts: - - name: "ssl-certs" - mountPath: "/etc/ssl/certs" - readOnly: true - volumes: - - name: "ssl-certs" - hostPath: - path: "/etc/ssl/certs" ---- - apiVersion: "v1" - kind: "Service" - metadata: - labels: - name: "kubedash" - name: "kubedash" - namespace: "kube-system" - spec: - ports: - - - port: 80 - targetPort: 8289 - selector: - name: "kubedash" diff --git a/src/k8s/add-ons/skydns-rc.yaml b/src/k8s/add-ons/skydns-rc.yaml index 05d924d..ec7af8c 100644 --- a/src/k8s/add-ons/skydns-rc.yaml +++ b/src/k8s/add-ons/skydns-rc.yaml @@ -1,41 +1,42 @@ apiVersion: v1 kind: ReplicationController metadata: - name: kube-dns-v17 + name: kube-dns-v19 namespace: kube-system labels: k8s-app: kube-dns - version: v17 + version: v19 kubernetes.io/cluster-service: "true" spec: replicas: 1 selector: k8s-app: kube-dns - version: v17 + version: v19 template: metadata: labels: k8s-app: kube-dns - version: v17 - kubernetes.io/cluster-service: "true" + version: v19 + annotations: + scheduler.alpha.kubernetes.io/critical-pod: '' + scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]' spec: containers: - name: kubedns - image: gcr.io/google_containers/kubedns-amd64:1.5 + image: gcr.io/google_containers/kubedns-amd64:1.7 resources: # TODO: Set memory limits when we've profiled the container for large # clusters, then set request = limit to keep this container in # guaranteed class. Currently, this container falls into the # "burstable" category so the kubelet doesn't backoff from restarting it. limits: - cpu: 100m - memory: 200Mi + memory: 170Mi requests: cpu: 100m - memory: 100Mi + memory: 70Mi livenessProbe: httpGet: - path: /healthz + path: /healthz-kubedns port: 8080 scheme: HTTP initialDelaySeconds: 60 @@ -49,7 +50,7 @@ spec: scheme: HTTP # we poll on pod startup for the Kubernetes master service and # only setup the /readiness HTTP server once that's available. - initialDelaySeconds: 30 + initialDelaySeconds: 3 timeoutSeconds: 5 args: # command = "/kube-dns" @@ -64,10 +65,20 @@ spec: protocol: TCP - name: dnsmasq image: gcr.io/google_containers/kube-dnsmasq-amd64:1.3 + livenessProbe: + httpGet: + path: /healthz-dnsmasq + port: 8080 + scheme: HTTP + initialDelaySeconds: 60 + timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 5 args: - --cache-size=1000 - --no-resolv - --server=127.0.0.1#10053 + - --log-facility=- ports: - containerPort: 53 name: dns @@ -76,19 +87,24 @@ spec: name: dns-tcp protocol: TCP - name: healthz - image: gcr.io/google_containers/exechealthz-amd64:1.0 + image: gcr.io/google_containers/exechealthz-amd64:1.2 resources: - # keep request = limit to keep this container in guaranteed class limits: - cpu: 10m - memory: 20Mi + memory: 50Mi requests: cpu: 10m - memory: 20Mi + # Note that this container shouldn't really need 50Mi of memory. The + # limits are set higher than expected pending investigation on #29688. + # The extra memory was stolen from the kubedns container to keep the + # net memory requested by the pod constant. + memory: 50Mi args: - - -cmd=nslookup kubernetes.default.svc.cluster.local 127.0.0.1 >/dev/null - - -port=8080 - - -quiet + - --cmd=nslookup kubernetes.default.svc.cluster.local 127.0.0.1 >/dev/null + - --url=/healthz-dnsmasq + - --cmd=nslookup kubernetes.default.svc.cluster.local 127.0.0.1:10053 >/dev/null + - --url=/healthz-kubedns + - --port=8080 + - --quiet ports: - containerPort: 8080 protocol: TCP diff --git a/src/k8s/download_dashboard.sh b/src/k8s/download_dashboard.sh new file mode 100755 index 0000000..cf97bf5 --- /dev/null +++ b/src/k8s/download_dashboard.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# download_dashboard.command +# Kube-Solo for macOS +# +# Created by Rimantas on 03/06/2015. +# Copyright (c) 2014 Rimantas Mocevicius. All rights reserved. + +function pause(){ +read -p "$*" +} + +rm -f add-ons/dashboard-controller.yaml +rm -f add-ons/dashboard-service.yaml + +# +curl -L https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/dashboard/dashboard-controller.yaml > add-ons/dashboard-controller.yaml +curl -L https://raw.githubusercontent.com/kubernetes/kubernetes/master/cluster/addons/dashboard/dashboard-service.yaml > add-ons/dashboard-service.yaml + +# +echo "Download has finished !!!" +pause 'Press [Enter] key to continue...' diff --git a/src/k8s/download_k8s.sh b/src/k8s/download_k8s.sh index 0f8156f..df3350a 100755 --- a/src/k8s/download_k8s.sh +++ b/src/k8s/download_k8s.sh @@ -28,7 +28,7 @@ chmod a+x kubectl # download latest version of linux k8s binaries mkdir kube -bins=( kubectl kubelet kube-proxy kube-apiserver kube-scheduler kube-controller-manager ) +bins=( kubelet kube-proxy kube-apiserver kube-scheduler kube-controller-manager ) for b in "${bins[@]}"; do curl -L https://storage.googleapis.com/kubernetes-release/release/$K8S_VERSION/bin/linux/amd64/$b > kube/$b done diff --git a/src/k8s/kube.tgz b/src/k8s/kube.tgz index 432617c..04b502b 100644 Binary files a/src/k8s/kube.tgz and b/src/k8s/kube.tgz differ diff --git a/src/k8s/kubectl b/src/k8s/kubectl index 76ebb11..3e86720 100755 Binary files a/src/k8s/kubectl and b/src/k8s/kubectl differ diff --git a/src/kube-solo-install.command b/src/kube-solo-install.command index 8184274..9de382f 100755 --- a/src/kube-solo-install.command +++ b/src/kube-solo-install.command @@ -22,7 +22,7 @@ chmod +x ~/kube-solo/bin/* # copy ksolo file to ~/bin - cp -f "${res_folder}"/bin/ksolo ~/bin + cp -f "$1"/bin/ksolo ~/bin # copy user-data cp -f "$1"/cloud-init/* ~/kube-solo/cloud-init