Prerequisites

  1. install python-pip & python3-pip & ansible

    1. python-pip

      • Access https://www.python.org, download python and install it.

      • Once the installation is done, Check below command.

        1
        2
        $ python3 --version
        Python 3.7.4
        cs
    2. python3-pip

      • Download get-pip.py file

        1
        curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
        cs
      • Then run the following

        1
        python get-pip.py
        cs
    3. ansible

      1
      brew install ansible
      cs

Settings

  1. clone the kubespray repository

    1
    $ git clone https://github.com/kubernetes-sigs/kubespray.git
    cs
  2. execute follow the command.

    sudo pip install -r requirements.txt
     
    cp -rfp inventory/sample inventory/mycluster
     
    declare -a IPS=(10.10.1.3 10.10.1.4 10.10.1.5// cluster ips
     
    CONFIG_FILE=inventory/mycluster/hosts.yml python3 contrib/inventory_builder/inventory.py ${IPS[@]}
     
    cat inventory/mycluster/group_vars/all/all.yml
    cat inventory/mycluster/group_vars/k8s-cluster/k8s-cluster.yml
     
    ansible-playbook -i inventory/mycluster/hosts.yml --become --become-user=root cluster.yml
    cs
  3. if you encounter an error with ruamel.yaml during the process, then you should install ruamel.yaml using pip.

    sudo pip install ruamel.yaml
    cs

Check out

root@node1:~# kubectl version
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.0", GitCommit:"e8462b5b5dc2584fdcd18e61cfe9f1e4d970a529", GitTreeState:"clean", BuildDate:"2019-07-19T16:32:14Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.0", GitCommit:"e8462b5b5dc2584fdcd18e63cfe9f1e4d970a529", GitTreeState:"clean", BuildDate:"2019-07-19T16:32:14Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
 
 
root@node1:~# kubectl get nodes
NAME    STATUS   ROLES    AGE   VERSION
node1   Ready    master   11m   v1.12.3
node2   Ready    master   12m   v1.12.3
node3   Ready    <none>   11m   v1.12.3
node4   Ready    <none>   11m   v1.12.3
cs
Posted by 사용자 guru_k

댓글을 달아 주세요