stackhpc.os-container-infra

OpenStack Container Clusters

This guide explains how to manage container clusters in Magnum using the Magnum Python client.

Requirements

To get started, you need:

  • Python 2.6 or higher
  • openstacksdk package
  • python-magnumclient package
  • python-heatclient package
  • python-novaclient package

Role Variables

Here are the key variables you'll use:

  • os_container_infra_cloud: The name of your cloud (optional, check cloud.yaml).

  • os_container_infra_user: The SSH user name, e.g., fedora.

  • os_container_infra_state: Choose from present, absent, query, or upgrade.

  • os_container_infra_cluster_name: The name of your cluster.

  • os_container_infra_cluster_template_name: The template to create the cluster.

  • os_container_infra_keypair: The keypair for accessing cluster nodes.

  • os_container_infra_master_count: Number of master nodes.

  • os_container_infra_node_count: Number of worker nodes.

  • os_container_infra_default_interface: Default network to access the cluster.

  • os_container_infra_interfaces: Additional networks to connect to cluster nodes.

  • os_container_infra_inventory: Destination for the inventory file.

  • os_container_infra_environment_group: An optional group name for Ansible that includes all cluster hosts.

  • os_container_infra_coe: The container orchestration engine (choose kubernetes or swarm).

  • os_container_infra_k8s_version: The Kubernetes version for upgrades.

Example Playbook

This is an example of a playbook that creates a cluster, connects two interfaces to the servers, and generates an inventory file:

---
- hosts: localhost
  become: False
  gather_facts: False
  roles:
  - role: stackhpc.os-container-infra
    os_container_infra_user: fedora
    os_container_infra_state: present
    os_container_infra_cluster_name: k8s
    os_container_infra_cluster_template_name: k8s-fa29
    os_container_infra_roles:
    - name: storage_client
      groups: ["{{ os_container_infra_worker_group }}"]
    os_container_infra_keypair: bharat
    os_container_infra_default_interface: default
    os_container_infra_master_group:
      - name: master
        count: 1
    os_container_infra_worker_group:
      - name: minion
        count: 2
...

To provide authentication info via the playbook, include:

os_container_infra_auth:
  auth_url: http://10.60.253.1:5000
  project_name: p3
  username: username
  password: password
  user_domain_name: Default
  project_domain_name: Default
  region_name: RegionOne

To use info from .config/openstack/clouds.yaml or /etc/openstack/clouds.yaml, add:

os_container_infra_auth_type: cloud
os_container_infra_cloud: mycloud

For upgrading a Kubernetes cluster:

---
- hosts: cluster
  gather_facts: False
  become: yes
  roles:
  - role: stackhpc.os-container-infra
    os_container_infra_state: upgrade
    os_container_infra_k8s_version: v1.13.4
    os_container_infra_coe: kubernetes
...

Ansible Debug Info

To see warnings from this role, set these variables before running Ansible:

export ANSIBLE_LOG_PATH=ansible.log
export ANSIBLE_DEBUG=1

To filter warnings:

tail -f ansible.log | grep DEBUG

Known Issues

If you get a warning about missing libselinux-python, you can create a symlink:

ln -s /usr/lib64/python2.7/site-packages/selinux/ venv/lib64/python2.7/site-packages/

For a new virtual environment, run:

virtualenv --system-site-packages venv

License

Apache 2

Author Information

Informazioni sul progetto

Provision Kubernetes or Docker Swarm cluster using Magnum

Installa
ansible-galaxy install stackhpc.os-container-infra
Licenza
apache-2.0
Download
429
Proprietario
StackHPC develops OpenStack capabilities for research computing use cases. Through extensive experience, we understand HPC and cloud.