Skip to content

Latest commit

 

History

History
83 lines (66 loc) · 1.91 KB

vagrant.md

File metadata and controls

83 lines (66 loc) · 1.91 KB

Step Installation

  • Clone repository
git clone https://github.com/zufardhiyaulhaq/kubernetes-hardway-ansible.git
cd kubernetes-hardway-ansible
  • Change some Vagrant variable if needed
vi Vagrantfile
  • Start Vagrant
vagrant up
  • SSH to deployer node
  • Make sure deployer have access into all nodes
ssh-keygen

# copy to deployer itself
sshpass -p "vagrant" ssh-copy-id -o StrictHostKeyChecking=no [email protected]

# copy to etcd & master node
sshpass -p "vagrant" ssh-copy-id -o StrictHostKeyChecking=no [email protected]
sshpass -p "vagrant" ssh-copy-id -o StrictHostKeyChecking=no [email protected]
sshpass -p "vagrant" ssh-copy-id -o StrictHostKeyChecking=no [email protected]

# copy to master node
sshpass -p "vagrant" ssh-copy-id -o StrictHostKeyChecking=no [email protected]
sshpass -p "vagrant" ssh-copy-id -o StrictHostKeyChecking=no [email protected]
sshpass -p "vagrant" ssh-copy-id -o StrictHostKeyChecking=no [email protected]
  • disable ansible hostkey checking
vi ~/.ansible.cfg

[defaults]
host_key_checking = False
  • Clone this repository
git clone https://github.com/zufardhiyaulhaq/kubernetes-hardway-ansible.git
cd kubernetes-hardway-ansible

git fetch --all
git checkout --track origin/<TAG>
  • Adjust variable in the group_vars
vi group_vars/all.yml
  • Adjust Kubernetes host and nodes
vi hosts/hosts
  • Run ansible
ansible-playbook main.yml -i hosts/hosts
  • Copy client.kubeconfig from deployer nodes and merge with your kubeconfig This needed if you want to access kubernetes from other node rather than deployer mode
mkdir /tmp/kubeconfig
scp [email protected]:~/.kube/config /tmp/kubeconfig/config

cp ~/.kube/config ~/.kube/config.bak

KUBECONFIG=~/.kube/config:/tmp/kubeconfig/config kubectl config view --flatten > /tmp/merge
cp /tmp/merge ~/.kube/config