kolla-ansible/doc/source/reference/zun-guide.rst
confi-surya dbf754655f Following the new PTI for document build
For compliance with the Project Testing Interface [1]
as described in [2]

[1]
https://governance.openstack.org/tc/reference/project-testing-interface.html
[2]
http://lists.openstack.org/pipermail/openstack-dev/2017-December/125710.html

doc8 command is dropped from docs tox envs.
So this affect nothing and run in PEP8.

Related-Bug: #1765348

Depends-On: Icc7fe3a8f9716281de88825e9d5b2fd84de3d00a
Change-Id: Idf9a16111479ccc64004eac9508da575822a3df5
2018-05-21 10:51:59 +01:00

3.5 KiB

Zun in Kolla

"Zun is an OpenStack Container service. It aims to provide an OpenStack API for provisioning and managing containerized workload on OpenStack." For more details about Zun, see OpenStack Zun Documentation.

Preparation and Deployment

Zun requires kuryr and etcd services, for more information about how to configure kuryr refer to kuryr-guide.

To allow Zun Compute connect to the Docker Daemon, add the following in the docker.service file on each zun-compute node.

ExecStart= -H tcp://<DOCKER_SERVICE_IP>:2375 -H unix:///var/run/docker.sock --cluster-store=etcd://<DOCKER_SERVICE_IP>:2379 --cluster-advertise=<DOCKER_SERVICE_IP>:2375

Note

DOCKER_SERVICE_IP is zun-compute host IP address. 2375 is port that allows Docker daemon to be accessed remotely.

By default zun is disabled in the group_vars/all.yml. In order to enable it, you need to edit the file globals.yml and set the following variables:

enable_zun: "yes"
enable_kuryr: "yes"
enable_etcd: "yes"

Deploy the OpenStack cloud and zun.

$ kolla-ansible deploy

Verification

  1. Generate the credentials file:

    $ kolla-ansible post-deploy
  2. Source credentials file:

    $ . /etc/kolla/admin-openrc.sh
  3. Download and create a glance container image:

    $ docker pull cirros
    $ docker save cirros | openstack image create cirros --public \
      --container-format docker --disk-format raw
  4. Create zun container:

    $ zun create --name test --net network=demo-net cirros ping -c4 8.8.8.8

    Note

    Kuryr does not support networks with DHCP enabled, disable DHCP in the subnet used for zun containers.

    $ openstack subnet set --no-dhcp <subnet>
  5. Verify container is created:

    $ zun list
    
    +--------------------------------------+------+---------------+---------+------------+------------+-------+
    | uuid                                 | name | image         | status  | task_state | addresses  | ports |
    +--------------------------------------+------+---------------+---------+------------+------------+-------+
    | 3719a73e-5f86-47e1-bc5f-f4074fc749f2 | test | cirros        | Created | None       | 172.17.0.3 | []    |
    +--------------------------------------+------+---------------+---------+------------+------------+-------+
  6. Start container:

    $ zun start test
    Request to start container test has been accepted.
  7. Verify container:

    $ zun logs test
    PING 8.8.8.8 (8.8.8.8): 56 data bytes
    64 bytes from 8.8.8.8: seq=0 ttl=45 time=96.396 ms
    64 bytes from 8.8.8.8: seq=1 ttl=45 time=96.504 ms
    64 bytes from 8.8.8.8: seq=2 ttl=45 time=96.721 ms
    64 bytes from 8.8.8.8: seq=3 ttl=45 time=95.884 ms
    
    --- 8.8.8.8 ping statistics ---
    4 packets transmitted, 4 packets received, 0% packet loss
    round-trip min/avg/max = 95.884/96.376/96.721 ms

For more information about how zun works, see zun, OpenStack Container service.