WebDisk
Kubernetes

Managed Kubernetes on WebDisk VM

Published:

WebDisk Blog · category: Kubernetes · reading time: ~10 minutes

In short:- Managed Kubernetes on WebDisk VM is a cluster where we run the control plane and your VPS servers are the nodes. You buy a node in the shop like any other server, and you download the kubeconfig from the panel with one click.- The cluster comes with what a self-built installation usually lacks: a Service of type LoadBalancer with a public IP address, persistent volumes on NVMe and HDD drives, and updates carried out in a maintenance window.- SFS adds shared volumes (ReadWriteMany). One volume is mounted by many pods on different nodes at the same time. An ordinary PersistentVolumeClaim is all it takes – you do not install or maintain an NFS server.

Most Kubernetes clusters start the same way: three machines, kubeadm, an evening with the documentation, and the satisfaction of seeing kubectl get nodes report Ready. The hard part comes later. You have to upgrade the control plane without breaking etcd. You have to expose the application to the world, and the Service of type LoadBalancer hangs in Pending. You have to keep the data somewhere. And eventually somebody asks whether two replicas of the application can write to the same directory.

In this article we show what those four things look like in managed Kubernetes on WebDisk VM. We spend the most time on the last one, because shared volumes have recently become a ready-made feature: it is called SFS.

What is managed Kubernetes on WebDisk VM?

It is a Kubernetes cluster where the control plane runs on our side and the worker nodes are your VPS servers bought in the WebDisk VM panel. The split of responsibilities is simple:

  • We run the control plane – the Kubernetes API, etcd and the scheduler. Every customer has their own separate control plane (Kamaji technology), with backup and monitoring.
  • The nodes are yours. They are ordinary WebDisk VM servers started from a ready-made node image. You choose their size and number yourself.
  • You are responsible for the applications – for what you deploy in the cluster and how you configure it.

Getting started takes a few minutes:

  1. In the panel you create a cluster and pick the Kubernetes version.
  2. You buy nodes in the shop – the same way as an ordinary VPS.
  3. You download the kubeconfig and check kubectl get nodes.

For production use we recommend at least two nodes. Updates then proceed node by node, and an application with two replicas keeps running without interruption. We issue the kubeconfig for a period you choose yourself – every download is a new, short-lived certificate, so a file left behind on an old laptop is not a key forever.

You will find more about the service itself on the Kubernetes page, and about the servers you build the cluster from on the WebDisk VM page.

Why is a node an ordinary VPS?

Because then you pay for and scale the cluster the same way as servers: you add a machine when you need it and give it up when it is no longer needed. There is no separate price list for “Kubernetes nodes” and there are no fixed plans. You choose the vCPU, RAM and disk, and the calculator shows the amount before you buy.

This has three practical consequences:

  • You know the cost up front. You pay for servers, IP addresses and data storage. There is no extra charge for traffic.
  • The nodes see each other over a private network. Traffic between them does not go out to the internet.
  • You can replace or reinstall a node. Persistent volumes then move to another node, and the data stays where it is.

If you are still choosing an orchestrator, take a look at our comparison: Nomad vs Kubernetes vs Docker Swarm.

How do you expose an application to the internet?

You create a Service of type LoadBalancer, and the cluster assigns it a public address from the cluster IP pool. You build the pool in the panel: you buy an address, and the cluster routes traffic to it by itself. You do not install or configure a controller of your own.

For the application it looks just the way the big clouds have accustomed you to:

apiVersion: v1
kind: Service
metadata:
  name: sklep
spec:
  type: LoadBalancer
  selector:
    app: sklep
  ports:
    - port: 443
      targetPort: 8443

A moment later kubectl get service sklep will show an address in the EXTERNAL-IP column. The address comes from your pool, so it will not change without your knowledge and you can safely point a DNS record at it.

Where do you keep the data? Persistent NVMe and HDD volumes

Every cluster has two classes of persistent volumes: wdk-nvme on fast NVMe drives and wdk-hdd on high-capacity HDD drives. You request a volume with an ordinary PersistentVolumeClaim, and the platform creates the disk and attaches it to the node the pod is running on.

Three rules are worth knowing:

  • The access mode is ReadWriteOnce. The volume is a disk attached to a single node. It is a good choice for a database, a queue or any application with a single writing instance.
  • You expand a volume on the fly. You change the size in the PVC, without stopping the pod.
  • You set the capacity limit in the panel. Requests above the limit wait in Pending until you raise it. A mistake in a manifest will not turn into a surprise on the invoice.

A disk does have a natural limitation, though: at any given moment it belongs to one node. When several pods on different nodes need to use the same files, you need a different kind of volume.

When do you need a ReadWriteMany volume?

When several pods read and write the same files at the same time, and the pods run on different nodes. Typical examples:

  • A web application in several replicas with a directory of uploaded files – product photos, attachments, customer documents.
  • A CMS or an online shop whose plugins and media live on disk rather than in the database.
  • Batch jobs and CI pipelines in which one step writes a result and the following ones read it.
  • Data processing and machine learning, where many pods use a single dataset.
  • Legacy applications that cannot be quickly rewritten to use object storage.

In a self-managed cluster this usually ends with building your own NFS server or a distributed file system. Both solutions work, but somebody has to install, monitor, update and expand them. SFS takes that work off your hands.

What is SFS?

SFS is a shared file system in the private network of your servers. The data is held by a dedicated file server that we manage, and you create shares on it. A share is a dedicated space of a chosen size, available over the NFS protocol, version 4.1.

The key features:

  • Two classes of shares: NVMe and HDD. You choose the fast one for files in day-to-day use, and the high-capacity one for archives and large datasets.
  • You expand a share on the fly. Pods and servers do not have to unmount anything. A share can only be expanded.
  • SFS works exclusively in your private network. You can additionally narrow access to a share down to selected subnets.
  • One SFS serves both a cluster and ordinary servers. You can mount the same share on several VPS servers, and a Kubernetes cluster will use SFS as the source of ReadWriteMany volumes.

You launch SFS in the WebDisk VM panel, in the “SFS – shared volumes” section. Preparing the file server usually takes a few minutes.

How do you use SFS in a Kubernetes cluster?

You connect SFS to the cluster with one button in the panel, and two new classes appear in the cluster: wdk-shared-nvme and wdk-shared-hdd. From that moment on, every PVC of these classes with the ReadWriteMany mode becomes an SFS share.

An example volume claim:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: media
spec:
  accessModes:
    - ReadWriteMany
  storageClassName: wdk-shared-nvme
  resources:
    requests:
      storage: 20Gi

And an application in three replicas that uses it:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: sklep
spec:
  replicas: 3
  selector:
    matchLabels:
      app: sklep
  template:
    metadata:
      labels:
        app: sklep
    spec:
      containers:
        - name: sklep
          image: registry.example.com/sklep:1.4
          volumeMounts:
            - name: media
              mountPath: /var/www/media
      volumes:
        - name: media
          persistentVolumeClaim:
            claimName: media

Each of the three replicas sees the same /var/www/media directory, regardless of which node it runs on. A file written by one replica can be read by the others.

What happens behind the scenes:

  • The platform creates the SFS share by itself, with the size taken from the PVC, and attaches it to the pods. You do not install any additional driver in the cluster.
  • The share is visible in the panel with a note that it belongs to a cluster volume. You expand it and delete it from the cluster, just like any other volume.
  • Expanding it means changing one number. You raise storage in the PVC, and the new capacity is visible in the running pods.
  • Deleting the PVC deletes the share together with the data. It is worth remembering before you clean up a namespace.

Two things to check before you start: SFS and the cluster must be in the same private network, and one cluster connects to one SFS.

Can I also mount SFS on an ordinary server?

Yes. You can mount a share created in the panel on any Linux server in the same private network – on several at once, too. The panel shows a ready-made mount command for every share, to be copied with one click. It looks like this:

sudo mount -t nfs4 -o vers=4.1,hard <sfs-address>:/<share> /mnt/shared

It is a convenient way to give several application servers a common directory, or to move files from an old machine into the cluster: the same SFS is visible to both the VPS servers and the pods.

One note for administrators: the share does not trust the root account on the client side (root_squash). Grant directory permissions to ordinary users and groups, and in Kubernetes run your pods without root privileges – that is good practice anyway.

SFS or an NVMe disk – which should you choose?

Choose a disk (ReadWriteOnce) for data that is written by a single instance and requires the highest performance. Choose SFS (ReadWriteMany) for files shared between pods or servers.

  • A database, a queue, a search index – a wdk-nvme volume. Databases should not live on a shared file system.
  • Uploaded files, media, job results, shared configuration – a wdk-shared-nvme or wdk-shared-hdd volume.
  • Large sets of rarely changed data – the HDD class, on a disk or in SFS, depending on the number of consumers.
  • Files served to users over HTTP, backups, archives – object storage will often be the better fit. See Object Storage.

SFS is not a substitute for a backup. A shared volume will just as faithfully keep a file deleted or overwritten by mistake, which is why important data is worth copying outside the cluster.

What do cluster updates look like?

You update the control plane with a button in the panel, and the nodes either by reinstalling them or through an announced update wave in a maintenance window. In both cases applications with at least two replicas on different nodes keep running without interruption.

  • Control plane. Raising the version takes a short time. The cluster API may be briefly unavailable while it happens, but the pods keep working. The version cannot be lowered.
  • Nodes. They are not updated together with the control plane. You can reinstall a node yourself, onto a newer image, or wait for an update wave.
  • Update wave. We announce it by e-mail and carry it out in the maintenance window that you set yourself. The nodes are drained and reinstalled one after another, respecting your PodDisruptionBudget objects. You can postpone the date once.

Persistent volumes and SFS shares go through an update unchanged – the data is not part of the node.

Where do you start?

Create a cluster in the WebDisk VM panel, add two nodes and deploy your first application. You can attach SFS later, when the first shared directory comes along.

  1. Go to vm.webdisk.io and work out your servers in the calculator.
  2. Create a cluster and add nodes.
  3. Buy an IP address for the cluster pool if the application is to be reachable from the internet.
  4. When you need a ReadWriteMany volume, launch SFS and connect it to the cluster.

You will find step-by-step instructions in the help centre: Kubernetes on WebDisk VM and SFS – shared volumes. Prefer Terraform to clicking? See managing Apache CloudStack with Terraform. And if you would rather talk the architecture through first, get in touch.

Frequently asked questions

What is a ReadWriteMany (RWX) volume? It is a volume that can be mounted for writing by many pods on different nodes at the same time. An ordinary disk works in ReadWriteOnce mode, which means it belongs to one node at a time. On WebDisk VM, ReadWriteMany volumes are provided by SFS.

Do I have to install an NFS server or a driver in the cluster myself? No. Once SFS is connected to the cluster, the platform adds the wdk-shared-nvme and wdk-shared-hdd classes by itself, along with everything the nodes need for mounting. You only create a PersistentVolumeClaim.

Can I expand a shared volume without downtime? Yes. You change the size in the PVC or in the panel, and the new capacity is visible in the running pods. A share can only be expanded – shrinking requires creating a new, smaller share and moving the data.

Can servers outside the cluster use SFS? Yes. You can mount a share created in the panel on any Linux server in the same private network. SFS is not reachable from the internet.

How is SFS billed? The bill consists of a base fee for SFS itself and a fee for the ordered capacity of the shares, separately for the NVMe and HDD classes. Volumes created from the cluster count the same way as shares created in the panel. The panel shows the current rates before you launch the service.

How many nodes does a cluster need? A cluster will work with one node, but for production use we recommend at least two. With a single node, every update and reinstallation stops the applications for a moment.

Do I have to update Kubernetes myself? You update the control plane with one button, whenever you decide to. We announce node image updates and carry them out in the maintenance window you choose. You can also reinstall a node yourself at any time.

Will the data in the volumes survive a node replacement? Yes. Persistent NVMe and HDD volumes move to another node, and SFS shares are not tied to a node at all. The data disappears only when you delete the volume or the share.