Set up Staging DOKS
Introduction
This section will show you how to create a DigitalOcean Kubernetes Cluster (DOKS) cluster which will be used as a staging
environment, targeting the online boutique sample application used as a reference in this guide.
Note
A staging environment should be pretty close (if not similar) to a production environment hence you will be creating a bigger cluster, resource wise, to be able to handle the workload you would normally have on your production environment.
Prerequisites
To complete this section you will need:
- Doctl utility already installed as explained in the Installing Required Tools -> Doctl section.
- Make sure that you're authenticated with the DigitalOcean API as explained in the Authenticating with the DigitalOcean API section.
Provisioning a Staging DOKS Cluster for Microservices
In this step, you will create a new Kubernetes cluster running on the DigitalOcean platform, using the doctl utility.
Following command will create a DigitalOcean Kubernetes cluster named microservices-demo-staging
, with a pool size of 3 nodes
, auto-scale to 2-4
each having 2 vCPUs
and 4gbGB
of RAM, in the nyc1
region:
doctl k8s cluster create microservices-demo-staging \
--auto-upgrade=true \
--maintenance-window "saturday=21:00" \
--node-pool "name=basicnp;size=s-2vcpu-4gb-amd;count=3;tag=cluster2;label=type=basic;auto-scale=true;min-nodes=2;max-nodes=4" \
--region nyc1
Note
- The example cluster created above is using 3 nodes, each having 2vCPU/4GB size, which amounts to 84$/month.
- For simplicity and consistency through all the guide, the microservices-demo-staging name was picked for the example cluster. You can choose any name you like, but you need to make sure the naming convention stays consistent.
- It is recommended to use a region for your cluster that is closest to you for faster interaction. Run the following command -
doctl k8s options regions
to check available regions. - Cluster auto upgrade is enabled (
--auto-upgrade=true
). Kubernetes clusters should be auto-upgraded to ensure that they always contain the latest security patches.
Next, you can verify the cluster details. First, fetch your DOKS
cluster ID
:
Finally, check if the kubectl
context was set to point to your DOKS
cluster. The doctl
utility should do this automatically:
For more info on this topic please see this Kubernetes Starter Kit DOKS Creation.
Configuring DOKS for Private Registries
From the command line run the following:
This will configure your DOKS cluster to fetch images from your DOCR created in the Set up a DigitalOcean container registry section
This step can also be achieved via the DigitalOcean cloud console. Please follow this guide.
Next, you will learn how to deploy the online boutique sample application to your staging cluster using Kustomize
.