tomkukral / picokube

Kubernetes for minimalists

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Picokube

Minimalized version of Kubernetes. Components (except kubelet) are running containerized so you don’t need any more VMs.

These scripts can be used for quick bootstrapping of Kubernetes and Etcd. Predefined values are prepared for running on localhost but it can be easily changed to multi node scenario.

Configuration variables

Name Default Description

ETCD_IMAGE

quay.io/coreos/etcd:latest

etcd is running from this image

ETCD_NAME

0

cluster name of etcd server

ETCD_LISTEN_IP

127.0.0.1

etcd listen on this address

ETCD_ADVERTISE_IP

127.0.0.1

address advetised to etcd clients

MASTER

127.0.0.1

address of Kubernetes master (API server)

NODE_IP

127.0.0.1

SERVICERANGE

172.18.0.0/24

IP range used for Kubernetes services

IMAGE

gcr.io/google_containers/hyperkube-amd64:v1.9.2

Kubernetes components are using this image

ETCD_SERVERS

http://127.0.0.1:4001

Kubernetes uses this etcd server

RESTART

no

Restart policy for Kubernetes containers

Usage

  1. Prepare before demo (pull images)

    ./etcd.sh pull-only
    ./kubernetes.sh pull-only
  2. Get binaries (optional). Needed only for kubelet-bare and testing etcdctl.

    ./etcd.sh get-binary
    ./kubernetes.sh get-binary

It will copy etcd, etcdctl and hyperkube to ./bin/ directory. Make sure this directory is writable via docker volume mount. You will probably need to run (as root) something like chcon -Rvt svirt_sandbox_file_t ./bin if you are using SELinux.

  1. Start etcd server

    ./etcd.sh
  2. (Optional) Test etcd server

    ./bin/etcdctl set /me $(whoami) && ./bin/etcdctl get /me
  3. Start Kubernetes services

    1. API server

      ./kubernetes.sh apiserver
    2. Controller Manager

      ./kubernetes.sh controller-manager
    3. Scheduler

      ./kubernetes.sh scheduler
    4. Proxy

      ./kubernetes.sh proxy
    5. Kubelet

Kubelet can be launched in container but this approach is highly discouraged since it is experimental and may break anytime. It is recommended to use kubelet-bare but be aware this wrapper runs binary on your system (not in container!). It is required to run kubelet-bare are root.

./kubernetes.sh kubelet

or

./kubernetes.sh kubelet-bare NODE_IP

Please be aware kubelet-bare will not fork into background and you should dedicate new terminal windows for it. Substitute NODE_IP with your IP address.

  1. Create sample app in Kubernetes

    1. Create service

      ./bin/kubectl apply -f examples/nginx/nginx-svc.yml
    2. Create nginx deployment

      ./bin/kubectl apply -f examples/nginx/nginx-deploy.yml
  2. Enjoy

cat

About

Kubernetes for minimalists


Languages

Language:Shell 100.0%