# Get started on OpenStack with DevStack

When you think about building your own cloud, you might think of creating a Kubernetes cluster across several machines so you can run and orchestrate containerized applications.
That's a good start for some organizations, but as your userbase grows, you may find the need to scale more than just the containers your cluster is running.
You might find that at some point, you need to scale your Kubernetes clusters themselves.
OpenStack manages the infrastructure your clusters run on, and with OpenStack you can allot compute, storage, and networking resources as needed by your cloud.
Red Hat has a detailed overview of [installing OpenShift on OpenStack](https://www.redhat.com/en/resources/red-hat-tested-openshift-openstack-reference-architecture) that explains all the considerations for a high-performance and scalable private cloud, and recommended resources include some pretty big numbers, like 112 GB of RAM, 28 vCPUs, and so on.
Before you commit those resources, you might want to learn some of the tooling around OpenStack, such as Keystone (for identity), swift (for object storage) and cinder (block storage), glance (image services), nova (compute), neutron (networking), and the Horizon dashboard.
You can get experience with all of these tools, and quite a lot more through a plugin system, with DevStack, a method provided by OpenStack developers to create a local install of OpenStack.

## Install

DevStack is, in many ways, the [OKD](https://www.redhat.com/sysadmin/learn-openshift-minishift) (formerly Minishift) or [Minikube](https://www.redhat.com/sysadmin/start-learning-kubernetes) of OpenStack.
It's designed for development and testing, and while it's very flexible in what it lets you do it's also not meant for production use.
DevStack can help you understand the many components of OpenStack, and how to customize them.

A few important requirements:

### Sudo privileges

The DevStack installer requires `sudo` privileges.

### Dedicated machine

Run DevStack on a dedicated a computer or virtual machine.

DevStack isn't as big as OpenStack, but it's still big.
The DevStack installer applies lots of changes to your system, so do not attempt to run it casually on your daily computer.

## 1. Git clone

Assuming you've got a dedicated machine and a user with `sudo` access, the first step is to clone the DevStack Git repo.
If you intend to develop on DevStack, omit the `--depth 1` option, but if you only intend to install and explore, then a "shallow clone" is sufficient:

```bash
$ git clone --depth 1 https://opendev.org/openstack/devstack
```

## 2. Configure

The DevStack installation process requires a few secrets during setup.
Create your own in a file called `local.conf` at the root level of the git repository you just cloned:

```bash
$ cat << EOF >> devstack/local.conf
[[local|localrc]]
ADMIN_PASSWORD=MySecretPassword123
DATABASE_PASSWORD=\$ADMIN_PASSWORD
RABBIT_PASSWORD=\$ADMIN_PASSWORD
SERVICE_PASSWORD=\$ADMIN_PASSWORD
EOF
```

DevStack includes a sample configuration file in the `samples` directory, so review that if you want to see more about what's possible before installing.

## 3. Run the install script

Run the installer:

```bash
$ cd devstack
$ chmod +x ./stack.sh
$ ./stack.sh
```

This can take some time, depending on your Internet connection speed.
It defaults to an unattended install, though, so once you get a good idea of what the script is doing, feel free to wander off for a cup of coffee.

## Stack

Once the install is finished, you must import some settings into your shell session:

```bash
$ source openrc
```

Now you have full access to the `openstack` command and its many subcommands.
You can view your current project list, which is mostly empty:

```bash
$ openstack project list
+--------------------+--------------------+
| ID                 | Name               |
+--------------------+--------------------+
| 0799779469[...]d35 | demo               |
| 1cc22ccfce[...]07d | invisible_to_admin |
+-----------------------------------------+
```

You can [download and create images](https://docs.openstack.org/image-guide/obtain-images.html).

```bash
$ wget http://download.cirros-cloud.net/0.x.y/cirros-0.x.y-x86_64-disk.img
$ openstack image create \
cirros-0.5.1-x86_64-disk.img
$ openstack image list
+--------------------+-------------------+--------+
| ID                 | Name              | Status |
+--------------------+-------------------+--------+
| b8ae9c5f-[...]6112 | cirros-[...]-disk | active |
| a85fd997-[...]3cde | cirros-[...]-disk | active |
+--------------------+-------------------+--------+
```

Alternately, you can use the Horizon dashboard, a web interface to your overcloud.

![OpenStack Horizon dashboard](horizon.jpg)

## Learning OpenStack

OpenStack has everything you need to build your own open hybrid cloud.
With S3-like object storage, easy integration with Kubernetes, OpenShift, and Kafka, an array of plugins and helper applications, and more, it's an excellent choice for a cloud platform, open and otherwise.
DevStack is an easy way to explore the utilities it provides, so grab a spare server or even a laptop and try it out.