Kubernetes on Raspberry Pi

使用kube-deploy部署kubernetes

How It Works

Docker Images

master:  
  docker-bootstrap:
  - gcr.io/google_containers/etcd-arm:2.2.5
  - quay.io/coreos/flannel:v0.6.1-arm
  docker:
  - gcr.io/google_containers/hyperkube-arm:v1.3.6
  - gcr.io/google_containers/kubernetes-dashboard-arm:v1.1.1
  - gcr.io/google_containers/exechealthz-arm:1.1
  - gcr.io/google_containers/kubedns-arm:1.5
  - gcr.io/google-containers/kube-addon-manager-arm:v4
  - gcr.io/google_containers/kube-dnsmasq-arm:1.3
  - gcr.io/google_containers/pause-arm:3.0
worker:  
  docker-bootstrap:
  - quay.io/coreos/flannel:v0.6.1-arm
  docker:
  - gcr.io/google_containers/hyperkube-arm:v1.3.6

Common Setup

$ vi /boot/cmdline.txt
- dwc_otg.lpm_enable=0 ... rootwait
+ dwc_otg.lpm_enable=0 ... rootwait cgroup_enable=cpuset
$ curl https://get.docker.com/ | sh
$ docker version
$ ifconfig
$ reboot

Master Setup

$ wget https://github.com/kubernetes/kube-deploy/archive/master.zip
$ unzip master.zip
$ cd kube-deploy-master/docker-multinode
$ ./master.sh

Worker Setup

$ wget https://github.com/kubernetes/kube-deploy/archive/master.zip
$ unzip master.zip
$ cd kube-deploy-master/docker-multinode
$ MASTER_IP=192.168.31.231 ./worker.sh

Client Setup

$ curl -sSL https://storage.googleapis.com/kubernetes-release/release/v2.3.6/bin/linux/amd64/kubectl > /usr/local/bin/kubectl
$ chmod +x /usr/local/bin/kubectl
$ kubectl -s http://192.168.31.231:8080 version

Quick Start

$ kubectl run app --image=easypi/nginx-arm --port=80
$ kubectl get deployments
$ kubectl describe deployments app
$ kubectl get pods

$ kubectl expose deployment app --type=NodePort
$ kubectl get services
$ kubectl describe svc app | grep NodePort

$ kubectl scale deployment app --replicas=4
$ kubectl get pods -o wide

$ kubectl set image deployment/app app=easypi/nginx-arm:v2
$ kubectl get deployments

$ kubectl delete service,deployment app

Issues

  • If k8s_apiserver on master cannot start, you need to restart it manually.
  • NodePort will only redirect traffic to pods on the same host.
  • Host reboot is not supported.

Read More