Kubernetes on Digital Ocean
- Prerequisites
- Creating a Kubernetes cluster on Digital Ocean
- Spaces Object Storage for Database Backups using Barman Object Store
- Deploying Vaadin Control Center
- Accessing Control Center
- Digital Ocean Container Registry
Digital Ocean is a cloud service provider headquartered in New York City, New York, USA. It provides cloud computing services including, but not limited to:
-
Droplets: on-demand Linux virtual machines.
-
Kubernetes: an easy-to-use managed Kubernetes service.
-
Spaces Object Storage: an S3-compatible service for storing and serving large amounts of data.
Here is a step-by-step guide on how to set up a Kubernetes cluster on Digital Ocean for deploying Vaadin Control Center.
Prerequisites
-
If you have not yet installed Kubernetes CLI
kubectl
, install it from the Kubernetes official site. -
If you have not yet installed Digital Ocean CLI
doctl
, install it from the Digital Ocean official site.
Creating a Kubernetes cluster on Digital Ocean
-
Sign up to Digital Ocean if you do not have an account yet at https://cloud.digitalocean.com/registrations/new.
-
Log in to https://cloud.digitalocean.com.
-
Create a new project or select an existing one.
-
Under the Manage section in the left-hand side menu, click on Kubernetes.
-
Click on Create a Kubernetes Cluster.
-
When creating a new Kubernetes cluster, select the following values:
-
Choose the recommended version for Kubernetes.
-
Choose the datacenter region closest to your potential customers.
-
Choose either to size network subnets yourself or let Digital Ocean size them for you.
-
Configure the cluster capacity as needed. You can set the node pool to autoscale as well.
-
Choose a unique name for your Kubernetes cluster.
-
Select a project for your cluster to be a part of.
-
[Optional] Add any tags you want.
-
Click on Create Kubernetes Cluster.
-
After the cluster is created and provisioning is complete, follow the instructions to connect to the cluster. Instructions on how to connect to the Digital Ocean cluster can be found here. You can use the following commands to check the connection and status of cluster objects.
Command | Description |
---|---|
| Lists your cluster name, user, and namespace |
| Display addresses of the control plane and cluster services |
| Display the client and server Kubernetes version |
| List all nodes created in the cluster |
| Displays commands that help manage your cluster |
Spaces Object Storage for Database Backups using Barman Object Store
Digital Ocean Spaces Object Storage is an S3-compatible service for storing and serving large amounts of data. Each Spaces bucket you create within an account has its own URL and can be used as a logical unit for segmenting content. You can create a Spaces Bucket to enable database backups using Barman Object Store, or to have somewhere where Write-Ahead Log (WAL) files archive can be stored. See Digital Ocean’s official documentation on how to create a Spaces Bucket.
Follow the instructions on setting up S3 compatible buckets in the backups section. Find the Digital Ocean Spaces example.
Deploying Vaadin Control Center
Make sure your kubectl
is in the context of the Digital Ocean cluster.
Source code
bash
# list contexts
kubectl config get-contexts
# change to Digital Ocean's context
kubectl config use-context <your_digital_ocean_cluster_context_name>
The run the following command after replacing the example values with your specifics:
Source code
bash
helm install control-center oci://docker.io/vaadin/control-center \
--set app.image.tag=1.3.1 \
-n example-namespace --create-namespace \
--set user.email=your@email.address.com \
--set domain=example.com
Tip
|
If you omit the app.image.tag parameter, latest tag is used instead.
|
Note
| You can check the status of the Control Center deployment with a few different commands outlined in our troubleshooting section. |
Setting Up DNS Records
To make Control Center accessible, there must exist a couple of DNS records associated with its domain. Refer to the Automatic DNS Records and Certificates section to do this automatically. The following instructions are for setting up DNS records manually.
Note
| See Digital Ocean’s official instructions on how to add domains |
Assuming a domain already exists in your Digital Ocean project, you must create one DNS record for the Control Center’s host address, and one DNS record for the Keycloak’s host address. These DNS records are used to access the Control Center application itself, and the Keycloak instance related to the Control Center installation. Both records must map to the IP address of the load balancer created during the installation of Control Center. The load balancer should appear as an option in the "Will direct to" field when creating a record.
Note
| See Digital Ocean’s official instructions on how to manage DNS records. |
Accessing Control Center
Get your temporary password for the Control Center.
Source code
bash
kubectl get secret control-center-user -n example-namespace -o go-template="{{ .data.password | base64decode | println }}"
Once Control Center has finished installing, the load balancer is ready and accepting connections, as well as DNS has propagated, you can type Control Center’s address in a browser search bar and Sign in to Vaadin Control Center with the email address you provided during the installation and the temporary password you retrieved in the previous step.
Digital Ocean Container Registry
To deploy applications using Control Center, it must have access to a container registry that includes the images of these applications.
It might be the case that you do not wish to publish these container images to public registries.
The Digital Ocean Container Registry (DOCR) is a private Docker image registry that lets you store and manage private container images.
DOCR integrates natively with Docker environments and Digital Ocean Kubernetes clusters.
To have Control Center use this private repository, update app.image.repository
and keycloak.image.repository
in helm install
so they reference DOCR.
See Digital Ocean’s official instructions on using Container Registry.