Creating a Cloud Platform environment
Overview
This is a guide to creating an environment (i.e. a namespace
) for your service in the Cloud Platform’s Kubernetes cluster.
In Kubernetes, namespaces provide a way to logically isolate your service and application from any others that reside on the Kubernetes cluster.
Creating a Cloud Platform environment is usually one of the first steps to complete when hosting your service on the Cloud Platform.
Once you have completed this guide, you will be able to add AWS resources to your service, such as databases and ECR repositories, and perform kubectl
commands against your namespace.
Prerequisites
You will need to:
- be part of the
ministryofjustice
GitHub organisation - be part of at least one GitHub team for your service
- have the Cloud Platform CLI installed
Creating a Cloud Platform environment
Once you have met the prerequisites, you can create an environment in the Cloud Platform by following this process:
Clone the
cloud-platform-environments
repository and change directory into it$ git clone https://github.com/ministryofjustice/cloud-platform-environments.git $ cd cloud-platform-environments
Use the Cloud Platform CLI to create your namespace
$ cloud-platform environment create
The CLI will prompt you for details about your namespace, and automatically create the appropriate Kubernetes and Terraform files in the correct location. Your namespace must meet the Ministry of Justice’s guidance on naming things.
Create a new branch, add your new files, and create a pull request in the
cloud-platform-environments
repository$ git checkout -b my-new-environment $ git add . $ git commit -m "Create namespace for my-new-environment" $ git push -u origin my-new-environment
Post your pull request in #ask-cloud-platform
Once approved by the Cloud Platform team, you can merge it
After your pull request is merged, the Apply pipeline will create your namespace in the cluster
Note: Please create one pull request per environment. This makes it easier for the Cloud Platform team to approve pull requests. If your pull request contains multiple environments, it will be automatically rejected.
Next steps
Once you’ve created your environment and your pull request has been merged, you can:
- authenticate to the cluster and use
kubectl
to access your environment - add AWS resources to your service, like databases and ECR repositories, and access the AWS console
- follow the Deploying a ‘Hello World’ application guide