Skip to content
Snippets Groups Projects
Select Git revision
  • 8cd7302be2250fb5c8ac4c1f9d64993c0c72f7ef
  • master default protected
  • freznicek-hands-on-8
  • freznicek-hands-on-8b
  • freznicek-hands-on-5
5 results

kubernetes-infra-example-dev-ost

  • Clone with SSH
  • Clone with HTTPS
  • Ing. Klára Moravcová's avatar
    Ing. Klára Moravcová authored
    Storage class
    
    See merge request !11
    8cd7302b
    History
    Name Last commit Last update
    ansible
    terraform
    README.md

    Prerequisites:

    Create Infrastructure

    Create openstack application credentials:

    • On tab Identity > application credentials
    • + create application credential
    • Give a name > Create Applicaiton Credential
    • Download file! (The application credential secret will not be available after closing this page, so you must capture it now or download it. If you lose this secret, you must generate a new application credential)
    git clone git@gitlab.ics.muni.cz:cloud/kubernetes/kubernetes-infra-example.git

    If required you may change the values as needed. (like infrastructure name, cluster size (master nodes, worker nodes groups), etc.)

    • ~/kubernetes-infra-example/terraform/main.tf
    • Give a path to your public ssh key at: ssh_public_key = "~/.ssh/id_rsa.pub"
    cd ~/kubernetes-infra-example/terraform/
    terraform init
    source ~/path/to/credentials.sh
    terraform apply

    Create Kubernetes Cluster

    • cd ~/kubernetes-infra-example/ansible/group_vars/all/
    • All possible group vars are in Kubespray project.
    • In openstack.yml modify the application credentials, can be the same credentials as already created.

    Install Kubernetes

    Prerequisites:

    cd ~/kubernetes-infra-example/ansible/01-playbook/
    sudo pip install -r requirements.txt
    ansible-galaxy install -r requirements.yml

    Run ansible playbook:

    cd ~/kubernetes-infra-example/ansible/01-playbook/
    ansible-playbook -i ../ansible_inventory --user=ubuntu --become --become-user=root play.yml

    Access via config

    • Kubeconfig is located in the artifacts directory, you can copy the config file to ~/.kube directory for local access.

    Access with SSH

    • If you need to access the cluster
    • Bastion ansible_hosts at ~/kubernetes-infra-example/ansible/ansible_inventory
    ssh -J ubuntu@<bastion_ip_address> ubuntu@<control-node_ip_address>
    # For example:
    # ssh -J ubuntu@195.113.167.169 ubuntu@10.10.10.26
    sudo -i
    kubectl get nodes

    Nginx Ingress Controller

    Prerequisites:

    helm repo add nginx-stable https://helm.nginx.com/stable
    helm repo update
    helm install nginx-ingress nginx-stable/nginx-ingress --set rbac.create=true
    kubectl get service