Goal: Demonstrate the use of an OpenStack based cloud backend for Krake. Krake uses the IM (Infrastructure Manager) provider as a backend for spawning a Kubernetes cluster. A Kubernetes cluster is then automatically registered in Krake and could be used for the application deployment.
This is an advanced user scenario where the user should register the existing infrastructure provider backend (IM) as well as an existing IaaS cloud deployment (OpenStack) before the actual cluster creation. The user is navigated to register those resources to Krake. Please read the brief overview of Krake’s infrastructure provider and cloud resources below:
Krake resources called GlobalInfrastructureProvider and InfrastructureProvider correspond to an infrastructure provider backend, that is able to deploy infrastructures (e.g. Virtual machines, Kubernetes clusters, etc.) on IaaS cloud deployments (e.g. OpenStack, AWS, etc.). Krake currently supports IM (Infrastructure Manager) as an infrastructure provider backend.
Krake resources called GlobalCloud and Cloud correspond to an IaaS cloud deployment (e.g. OpenStack, AWS, etc.) that will be managed by the infrastructure provider backend. GlobalCloud and Cloud resources could contain also metrics and labels, that could be used in Cluster scheduling. Krake currently supports OpenStack as a GlobalCloud or Cloud backend.
The global resource (e.g. GlobalInfrastructureProvider, GlobalCloud) is a non-namespaced resource that could be used by any (even namespaced) Krake resource. For example, the GlobalCloud resource could be used by any Cluster which needs to be scheduled to some cloud.
Note that file paths mentioned in this tutorial are relative to the root of the Krake repository.
Launch the IM infrastructure provider instance using the support script. Please note that the IM instance is launched in the docker environment, therefore it is mandatory to install docker beforehand.
Register an existing infrastructure provider to Krake¶
rok infra provider register --type im --url http://localhost:8800 --username test --password test im-provider
Register an existing OpenStack based cloud to Krake¶
Gather information about your OpenStack project from
- Insert the
OS_AUTH_URLvalue (without path) to the
--urlargument, e.g. https://identity.cloud.com:5000
- Insert the
OS_PROJECT_NAMEvalue to the
- Insert the
OS_USERNAMEvalue to the
- Insert the
OS_PASSWORDvalue to the
Use the already registered infrastructure provider called
im-provider as an infrastructure provider for your OpenStack cloud.
If you want to use the C&H F1A OpenStack cloud, please note that it does not assign public IPs to the VMs. C&H F1A requires a private network for all VMs. This private network is connected to the public one via a router. The router should be created beforehand as the IM provider is not able to do this. You can create the requested router in your C&H F1A OpenStack cloud project as follows:
openstack router create --external-gateway shared-public-IPv4 public_router
rok infra cloud register --type openstack --url <os-auth-url> --project <os-project-name> --username <os-username> --password <os-password> --infra-provider im-provider os-cloud
Create a Cluster¶
rok kube cluster list # No Cluster resource is present
rok kube cluster create -f rak/functionals/im-cluster.yaml my-cluster
rok kube cluster list # One Cluster resource with name "my-cluster"
The creation of the cluster can take up to 15 minutes to complete. Observe that Kubernetes Cluster is created.
rok kube cluster list
Spawn the demo application¶
Create the demo Kubernetes Application and observe the resource status.
rok kube app create -f rak/functionals/echo-demo.yaml echo-demo
rok kube app get echo-demo # See "running_on"
Delete the Cluster, the Cloud and the InfrastructureProvider:
rok kube cluster delete my-cluster
rok infra cloud delete os-cloud
rok infra provider delete im-provider