git clone https://github.com/zufardhiyaulhaq/kubernetes-hardway-ansible.git
cd kubernetes-hardway-ansible
- Change some Vagrant variable if needed
- 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
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
- Adjust Kubernetes host and nodes
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