Skip to content

Instantly share code, notes, and snippets.

@s1061123
Created February 13, 2020 03:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save s1061123/85c8ac62c10c54d516372015e751a29a to your computer and use it in GitHub Desktop.
Save s1061123/85c8ac62c10c54d516372015e751a29a to your computer and use it in GitHub Desktop.
kube-ansible demo log (ovn)
## Pull kube-ansible
[tohayash@tohayash-lab work]$ git clone https://github.com/redhat-nfvpe/kube-ansible.git
Cloning into 'kube-ansible'...
remote: Enumerating objects: 32, done.
remote: Counting objects: 100% (32/32), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 3019 (delta 8), reused 21 (delta 7), pack-reused 2987
Receiving objects: 100% (3019/3019), 529.58 KiB | 658.00 KiB/s, done.
Resolving deltas: 100% (1382/1382), done.
[tohayash@tohayash-lab work]$ cd kube-ansible
[tohayash@tohayash-lab kube-ansible]$ ansible-galaxy install -r requirements.yml
- extracting install-go to /home/tohayash/work/kube-ansible/roles/install-go
- install-go (master) was installed successfully
- extracting install-docker to /home/tohayash/work/kube-ansible/roles/install-docker
- install-docker (master) was installed successfully
- extracting redhat-nfvpe.vm-spinup to /home/tohayash/work/kube-ansible/roles/redhat-nfvpe.vm-spinup
- redhat-nfvpe.vm-spinup (master) was installed successfully
- extracting redhat-nfvpe.prometheus-operator to /home/tohayash/work/kube-ansible/roles/redhat-nfvpe.prometheus-operator
- redhat-nfvpe.prometheus-operator (master) was installed successfully
## Add Inventory file (for CentOS, i.e. python2)
[tohayash@tohayash-lab kube-ansible]$ cat << EOF > inventory/virthost.inventory
> virt_host ansible_host=127.0.0.1 ansible_ssh_user=root
>
> [virthost]
> virt_host
> EOF
## Add Inventory file (for Fedora, i.e. python3)
[tohayash@tohayash-lab kube-ansible]$ cat << EOF > inventory/virthost.inventory
> virt_host ansible_host=127.0.0.1 ansible_ssh_user=root ansible_python_interpreter=/usr/bin/python3
>
> [virthost]
> virt_host
> EOF
## If you want to change some config (nodes, VM memory, VM Core, etc...), change config in playbooks/ka-init/group_vars/all.yml
[tohayash@tohayash-lab kube-ansible]$ vi playbooks/ka-init/group_vars/all.yml
(snip)
## Setup VMs
[tohayash@tohayash-lab kube-ansible]$ ansible-playbook -i inventory/virthost.inventory playbooks/virthost-setup.yml
(snip)
## Install Kubernetes + ovn-kubernetes
[tohayash@tohayash-lab kube-ansible]$ ansible-playbook -i inventory/vms.local.generated -e 'container_runtime=crio' playbooks/kube-install-ovn.yml
(snip)
## Login node (kube-master, kube-node-1, ...)
[tohayash@tohayash-lab kube-ansible]$ ssh -i ~/.ssh/virt_host/id_vm_rsa centos@kube-master
Warning: Permanently added 'kube-master,192.168.122.5' (ECDSA) to the list of known hosts.
Last login: Thu Feb 13 03:23:44 2020 from gateway
[centos@kube-master ~]$
[centos@kube-master ~]$ kubectl get node
NAME STATUS ROLES AGE VERSION
kube-master Ready master 3m30s v1.17.3
kube-node-1 Ready <none> 2m57s v1.17.3
kube-node-2 Ready <none> 2m57s v1.17.3
#note: may need to wait several minutes to complete ovn install
## Teardown VMs
[tohayash@tohayash-lab kube-ansible]$ ansible-playbook -i inventory/virthost.inventory playbooks/vm-teardown.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment