Giter Site home page Giter Site logo

kitt1987 / simple-kubernetes Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 4.0 185 KB

An ansible playbook to install Kubernetes cluster

License: Apache License 2.0

Dockerfile 6.97% Makefile 2.46% Shell 16.85% Roff 73.73%
kubernetes-setup ansible kubernetes no-dependencies on-prem on-premise simple-kube

simple-kubernetes's Introduction

simple-kube

simple-kube aims to install Kubernetes not depend on any private or banned resources.

Install your cluster

Use the all-in-one image

The all-in-one image contains all images and configurations required by simple-kube.

bash <(curl -sL https://raw.githubusercontent.com/kitt1987/simple-kubernetes/master/run/all-in-one-1.17.1.sh)

Or,

bash <(curl -sL https://raw.githubusercontent.com/kitt1987/simple-kubernetes/master/run/all-in-one-1.16.6.sh)

Run simple-kube in container

bash <(curl -sL https://raw.githubusercontent.com/kitt1987/simple-kubernetes/master/run/simple-kube.sh)

Run the playbook

We've generated an SSH key pair in the container. You can install it on hosts outlined in the inventory. Or, generate your key pairs for security.

To install a cluster,

ansible-playbook -i inventory/sample deploy-cluster.yml

To clean an installation,

ansible-playbook -i inventory/sample clean-cluster.yml

Once failures arose before installation get done, clean the cluster would restore stale hosts.

To add new nodes, specify at least 1 master and all new nodes in the inventory and run,

ansible-playbook -i inventory/sample add-node.yml

To add new masters , specify all masters in the master group and all new masters in both master and nodes group, then run,

ansible-playbook -i inventory/sample add-master.yml

To remove masters , specify all available masters in the master group and masters to be removed in the nodes group, then run,

ansible-playbook -i inventory/sample remove-master.yml

Advanced Features

Build the ON-PREM version of simple-kube

In on-premise environments, simple-kube can't download images or configurations from the Internet. It provides an alternative way to build a new simple-kube image which doesn't need to fetch Internet resources.

  1. Run simple-kube by run/simple-kube.sh or make sure that /var/run/docker.sock is mounted to the container,
  2. Assure that the simple-kube container could access the Internet,
  3. Install a cluster,
  4. Set kube_release_version and disable verify_kube_release in the inventory,
  5. Commit the container to create a new simple-kube image.
docker commit -m "kubernetes version v1.12.9" -p simple-kube kitt0hsu/simple-kube:v1.12.9

Change Pod/Service CIDR

Before running the playbook, make sure hostnames, their IP addresses and the K8s version in the inventory exactly match your cluster.

ansible-playbook -i inventory/sample apply-cidrs.yml

After the playbook done successfully, your legacy cluster configuration and Etcd data were copied to directory /root/.simple-kube. You need to copy the SA certificate back to /etc/kubernetes/pki and restore the manifest of kube-apiserver to use the original SA certificate. Meanwhile, all services have to be rebuilt. Moreover, you have to update the configuration of CNI plugin manually.

Dependencies

From the Internet

simple-kube will download binaries and images. Some of them could be quite slow. In MainLand China, I strongly recommend you download binaries below manually, and specify them in the inventory.

From package repositories of distros

simple-kube also installs some packages on hosts while installing clusters. Most of them could be found in the official package repository of each distro. They are,

  • rsync

Feature List

  • Install compatible Docker automatically
  • Modify /etc/hosts to make hosts know each other if no DNS
  • Fetch the latest Kubernetes release from Github
  • Support CNI
  • Install HA cluster
  • Save all the downloaded files for following installation
  • Support HTTP_PROXY environment variables in the playbook and container
  • Install main stream CNI plugin
  • Parse coredns image from configuration
  • Compatible with kubeadm

simple-kubernetes's People

Contributors

kitt1987 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.