Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a requirement and installation doc for K3s #1624

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 86 additions & 1 deletion content/en/hosting/4.x/production/kubernetes/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,91 @@ relatedContent: >
hosting/requirements
hosting/kubernetes-vs-docker
---
Kubernetes is more complex set up of CHT hosting over [Docker]({{< relref "hosting/4.x/production/docker" >}}) . It enables maximum scalability for multi-node CouchDB and multi-tenant deployments.

Kubernetes is more complex set up of CHT hosting over [Docker]({{< relref "hosting/4.x/production/docker" >}}) . It enables maximum scalability for multi-node CouchDB and multi-tenant deployments.
## Introduction

[K3s](https://k3s.io) is a lightweight Kubernetes distribution and has no external dependencies.

However you plan on pushing CHT Core to k3s cluster just make sure all the requirements as per CHT [requirements](https://docs.communityhealthtoolkit.org/hosting/requirements).

## K3s minimal component:

* A fully functional Kubernetes cluster
* Sqlite as storage backend instead of etcd
* Containerd as default container runtime (not Docker)
* Flannel as container network plugin by default
* Traefik as Ingress controller
* Local storage provisioner as default StorageClass for persistent volumes

## Installation Options

#### **Installation Script**

Use the installation script to set up K3s as a service and by using the installation script we install K3s as systemd and openrc based systems.

To install K3s using the installation script, follow these steps:

1. **Download the Installation Script** :

```

curl -sfL https://get.k3s.io | sh -

```

This command downloads the script and runs it, installing K3s as a service on your system.

2. **Configuration Options** :

* You can use environment variables prefixed with `K3S_` or pass command flags to configure K3s2.
* For example, to set the server address:

```

exportK3S_SERVER=https://your-server-address:6443

curl -sfL https://get.k3s.io | sh -
```


3. **Verify the Installation** :
The below command checks if K3s is running and lists the nodes in your cluster.

```

k3s kubectl get nodes

```

#### Installing with binary

The installation script is primarily concerned with configuring K3s to run as a service.

If you choose to not use the script, you can run K3s simply by downloading the binary from our release page, placing it on your path, and executing it.

```

curl -Lo /usr/local/bin/k3s https://github.com/k3s-io/k3s/releases/download/v1.26.5+k3s1/k3s; chmod a+x /usr/local/bin/k3s

```

You can pass configuration by setting K3S_ environment variables:

```

k3s server --write-kubeconfig-mode=644

```

Or command flags:

```

k3s server --write-kubeconfig-mode=644

```

### Advanced Options / Configuration

For more details look [here](https://docs.k3s.io/installation)
Binary file added content/en/hosting/image.png
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This image is too small to be useful and I can't tell what it is. If you'd like to keep it, please move it to the new location under production 4.x k8s directory, make it higher resolution and ensure it's applicable for how to install CHT Core on k3s (and not a generic k3s architecture diagram).

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions content/en/hosting/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ relatedContent: >
hosting/3.x/self-hosting
hosting/3.x/ec2-setup-guide
---

{{% pageinfo %}}
For production CHT deployments, Linux is recommended, with [Ubuntu](https://ubuntu.com/server) the most commonly used. For App Developer Hosting, Linux or macOS may be used. Windows can be used for either, but without recommendation.
{{% /pageinfo %}}
Expand Down Expand Up @@ -39,7 +38,7 @@ This leverages Docker and requires:

### Kubernetes

This guide refers to "Kubernetes", but Medic recommends a lightweight orchestrator called [K3s](https://docs.k3s.io/) for bare-metal hosts. The requirements below refer to K3s deployments but can be translated to other Kubernetes hosting. For example, for cloud hosting, we recommend Amazon [Elastic Kubernetes Service](https://aws.amazon.com/eks/) (EKS) and we've also assisted in a [large K3s deployment based on VMWare]({{< relref "4.x/production/kubernetes/self-hosting-k3s-multinode" >}}).
This guide refers to "Kubernetes", but Medic recommends a lightweight orchestrator called [K3s](https://docs.k3s.io/) for bare-metal hosts. The requirements below refer to K3s deployments but can be translated to other Kubernetes hosting. For example, for cloud hosting, we recommend Amazon [Elastic Kubernetes Service](https://aws.amazon.com/eks/) (EKS) and we've also assisted in a [large K3s deployment based on VMWare]({{< relref "4.x/production/kubernetes/self-hosting-k3s-multinode" >}}).

Be sure to see the `cht-deploy` [script](https://github.com/medic/cht-core/tree/master/scripts/deploy) that leverage the `helm` [application](https://helm.sh/docs/intro/install/).

Expand All @@ -55,4 +54,5 @@ Be sure to see the `cht-deploy` [script](https://github.com/medic/cht-core/tree/
_\* During some upgrades, up to 3x current space used by CouchDB can be needed_

## Required skills

In addition to the hosting requirements, system administrators should have a basic understanding of command line interface, Kubernetes, docker, container orchestration, deployment, databases (CouchDB, Postgres), networking components (TLS, IP addresses, DNS).
Loading