This repository hosts a concrete implementation of an OpenStack provider for the cluster-api project.
Learn how to engage with the Kubernetes community on the community page.
You can reach the maintainers of this project at:
Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.
-
Install
kubectl
(see here). -
Install minikube, version 0.30.0 or greater.
-
Install a driver for minikube. For Linux, we recommend kvm2. For MacOS, we recommend VirtualBox.
-
An appropriately configured Go development environment
-
Build the
clusterctl
toolgit clone https://github.com/kubernetes-sigs/cluster-api-provider-openstack $GOPATH/src/sigs.k8s.io/cluster-api-provider-openstack cd $GOPATH/src/sigs.k8s.io/cluster-api-provider-openstack/cmd/clusterctl go build
-
Create the
cluster.yaml
,machines.yaml
,provider-components.yaml
, andaddons.yaml
files if needed:cd examples/openstack ./generate-yaml.sh --provider-os [os name] cd ../..
[os name] is the operating system of your provider environment. Supported Operating Systems:
ubuntu
centos
By default, the generater script will give you a series of command line prompts, asking the following information about your cloud provider:
- user-name
- domain-name
- project-id
- region-name
- auth-url
- password
If you want to generate scripts without being prompted interactively, you can pass generate-yaml a clouds.yaml file. After downloading your clouds.yaml from your provider, make sure that it has the information listed above filled out. It is very likely that it will at lest be missing the password field. Also, note that domain-name is the same as project-name. You may reference the following sample clouds.yaml to see what yours should look like.
clouds: openstack: auth: auth_url: https://yourauthurl:5000/v3 username: foo password: bar project_id: foobar123 project_name: foobar user_domain_name: "Default" region_name: "Region_1" interface: "public" identity_api_version: 3
To specify which cloud to use, set the OS_CLOUD environment variable with its name. By default, the generator will use the cloud "openstack". Based on the example above, the following command sets the correct cloud:
export OS_CLOUD=openstack
To pass a clouds.yaml file to generate-yaml, set the -c or --clouds options, followed by the path to a clouds.yaml file. Here are some examples of this syntax:
./generate-yaml.sh --provider-os [os name] -c clouds.yaml ./generate-yaml.sh --provider-os [os name] --clouds clouds.yaml
-
Create a cluster:
./clusterctl create cluster --minikube kubernetes-version=v1.12.1 --provider openstack -c examples/openstack/[os name]/out/cluster.yaml -m examples/openstack/[os name]/out/machines.yaml -p examples/openstack/[os name]/out/provider-components.yaml
To choose a specific minikube driver, please use the --vm-driver
command line parameter. For example to use the kvm2 driver with clusterctl you woud add --vm-driver kvm2
, for linux, if you haven't installed any driver, you can add --vm-driver none
.
Additional advanced flags can be found via help.
./clusterctl create cluster --help
Once you have created a cluster, you can interact with the cluster and machine resources using kubectl:
kubectl --kubeconfig=kubeconfig get clusters
kubectl --kubeconfig=kubeconfig get machines
kubectl --kubeconfig=kubeconfig get machines -o yaml
This guide explains how to delete all resources that were created as part of your openstack Cluster API Kubernetes cluster.
-
Delete all of the node Machines in the cluster. Make sure to wait for the corresponding Nodes to be deleted before moving onto the next step. After this step, the master node will be the only remaining node.
kubectl --kubeconfig=kubeconfig delete machines -l set=node kubectl --kubeconfig=kubeconfig get nodes
-
Delete the master machine.
kubectl --kubeconfig=kubeconfig delete machines -l set=master
-
Delete the ssh keypair that were created for your cluster machine.
rm -rf $HOME/.ssh/openstack_tmp*