Skip to content

Set up Production DOKS

Introduction

This section will show you how to create a DigitalOcean Kubernetes Cluster (DOKS) cluster which will be used as the production environment, targeting the online boutique sample application used as a reference in this guide. A Kubernetes environment is referred to as production-ready when it has everything needed to serve traffic to real end users and has the resources to adapt to changing demands. A production environment should be secure, scalable, highly available and reliable, and must provide logging and monitoring capabilities that meet organizational requirements.

Prerequisites

To complete this section you will need:

  1. Doctl utility already installed as explained in the Installing Required Tools -> Doctl section.
  2. Make sure that you're authenticated with the DigitalOcean API as explained in the Authenticating with the DigitalOcean API section.

Provisioning a Production 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-production, with a pool size of 4 nodes, auto-scale to 3-5 each having 2 vCPUs and 4gbGB of RAM, in the nyc1 region:

doctl k8s cluster create microservices-demo-production \
  --auto-upgrade=true \
  --maintenance-window "saturday=21:00" \
  --node-pool "name=basicnp;size=s-2vcpu-4gb-amd;count=4;tag=cluster2;label=type=basic;auto-scale=true;min-nodes=3;max-nodes=5" \
  --region nyc1

Note

  • The example cluster created above is using 4 nodes, each having 2vCPU/4GB size, which amounts to 94$/month.
  • For simplicity and consistency through all the guide, the microservices-demo-production 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:

doctl k8s cluster list

Finally, check if the kubectl context was set to point to your DOKS cluster. The doctl utility should do this automatically:

kubectl config current-context

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:

doctl registry kubernetes-manifest | kubectl apply -f -

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 production cluster using Kustomize.