Coder Social home page Coder Social logo

ptzagk / ansible-centos7-kubespray Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lvthillo/ansible-centos7-kubespray

0.0 0.0 0.0 10 KB

Local setup of Kubernetes using VMware Fusion, ansible and Kubespray

Home Page: https://medium.com/@lvthillo/install-kubernetes-on-bare-metal-centos7-fba40e9bb3de

License: MIT License

ansible-centos7-kubespray's Introduction

ansible-centos7-kubespray

Ansible playbook to configure prerequisites for Kubespray on CentOS7

Prerequisites for the CentOS7 machines:

  • SSH access using password with a user who has root permissions (centos in example)
  • A public key generated on your local machine

This playbook will:

  • Update packages
  • Install network tools
  • Install and configure ntpd
  • disable firewall
  • disable swap
  • enable passwordless sudo
  • enable passwordless SSH
  • set hostname

Add the IP's of your CentOS7 servers in the hosts.ini.

[all]
node1 ansible_host=192.168.140.101
node2 ansible_host=192.168.140.102
node3 ansible_host=192.168.140.103

Start the playbook. Define variables like root password, user, group and path to the public key.

$ ansible-playbook -i hosts.ini -u centos -k playbook.yml --extra-vars "ansible_sudo_pass=supersecret  user=centos group=centos pubkeypath=~/.ssh/id_rsa.pub"

After running the playbook you can start with Kubespray:

$ git clone https://github.com/kubernetes-incubator/kubespray
$ cd kubespray
$ git checkout v2.7.0

Follow the instructions described in the README.md

# Install dependencies from ``requirements.txt``
$ sudo pip install -r requirements.txt

# Copy inventory/sample as inventory/mycluster
$ cp -rfp inventory/sample inventory/mycluster

# Update Ansible inventory file with inventory builder
$ declare -a IPS=(192.168.140.101 192.168.140.102 192.168.140.103)
$ CONFIG_FILE=inventory/mycluster/hosts.ini python3 contrib/inventory_builder/inventory.py ${IPS[@]}

# Review and change parameters under inventory/mycluster/group_var
$ cat inventory/mycluster/group_vars/all.yml
$ cat inventory/mycluster/group_vars/k8s-cluster.yml
# Optional: modify the hosts.ini file to your needs.
$ vi inventory/mycluster/hosts.ini
[all]
node1   ansible_host=192.168.140.101 ip=192.168.140.101
node2   ansible_host=192.168.140.102 ip=192.168.140.102
node3   ansible_host=192.168.140.103 ip=192.168.140.103
# possible to add additional masters
[kube-master]
node1
[kube-node]
node2
node3
# possible to add additional etcd's
[etcd]
node1
[k8s-cluster:children]
kube-node
kube-master
[calico-rr]
[vault]
node1
node2
node3

Deploy Kubespray with Ansible Playbook.

$ ansible-playbook -u centos -b -i inventory/mycluster/hosts.ini cluster.yml

More details and configuration can be found here.

ansible-centos7-kubespray's People

Contributors

lvthillo 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.