Giter VIP home page Giter VIP logo

ansible-k8s's Introduction

ansible ploybooks to deploy kubernetes cluster

Requirements

control machine requirements:

  • ansible: 2.2 or later
  • python-netaddr

Deploy k8s cluster

  1. Modify inventory.ini and group_vars/all.yml to suit your need

  2. Deploy all components

    ansible-playbook deploy-cluster.yml
    

    or one by one

    ansible-playbook prepare.yml
    ansible-playbook deploy-etcd.yml
    ansible-playbook deploy-master.yml
    ansible-playbook deploy-node.yml
    ansible-playbook deploy-addons.yml
    
  3. To add more nodes after cluster is up and running, just add new nodes to inventory.ini and run

    ansible-playbook deploy-node.yml
    

If using password instead of ssh key to access remote machines, add -k to all above commands. If the user on remote machin needs password to execute sudo command, add -K to all above commands.

Eg. ansible-playbook deploy-cluster.yml -k -K

Destroy k8s cluster

For testing purpose, we sometimes need to destroy k8s cluster and redeploy. Just run following command to destroy the entire cluster.

ansible-playbook destroy.yml

Note: This will destroy kubernetes cluster permanently, think carefully before running this command.

Vagrant

If you do not have multiple machines, you can use vagrant to bring up multiple VMs.

  1. Run vagrant up to bring up 3 VMs for testing

  2. Run vagrant ssh kube-master to login to kube-master

  3. Install ansible and python-netaddr on kube-master(control machine)

    sudo add-apt-repository ppa:ansible/ansible
    sudo apt-get update && sudo apt-get install -y ansible python-netaddr
    
  4. Deploy kubernetes

    cd /vagrant
    ansible-playbook deploy-cluster.yml
    

Limitations

  • No support for HA masters
  • No support for HA etcd clusters
  • Only support calico network plugin
  • Only ubuntu-14.04 tested

ansible-k8s's People

Contributors

tennix avatar

Watchers

 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.