Skip to content

Commit f977191

Browse files
author
Katie Horne
authored
chore: refactor CVMs docs (#637)
1 parent 08f875a commit f977191

File tree

6 files changed

+246
-207
lines changed

6 files changed

+246
-207
lines changed

admin/workspace-management/cvms.md

-206
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: Cluster setup
3+
description: Learn how to set up K8s clusters capable of supporting CVMs.
4+
---
5+
6+
The following sections show how you can set up your Kubernetes clusters hosted
7+
by Google, Azure, and Amazon to support CVMs.
8+
9+
## Google Cloud Platform w/ GKE
10+
11+
To use CVMs with GKE, [create a cluster](../../../setup/kubernetes/google.md)
12+
with the following parameters set:
13+
14+
- GKE Master version `latest`
15+
- `node-version = "latest"`
16+
- `image-type = "UBUNTU"`
17+
18+
Example:
19+
20+
```console
21+
gcloud beta container clusters create "YOUR_NEW_CLUSTER" \
22+
--node-version "latest" \
23+
--cluster-version "latest" \
24+
--image-type "UBUNTU"
25+
...
26+
```
27+
28+
## Azure Kubernetes Service
29+
30+
If you're using Kubernetes version `1.18`, Azure defaults to the correct Ubuntu
31+
node base image. When
32+
[creating your cluster](../../../setup/kubernetes/azure.md), set
33+
`--kubernetes-version` to `1.18.x` or newer for CVMs.
34+
35+
## Amazon Web Services w/ EKS
36+
37+
You can modify an existing
38+
[AWS-hosted container](../../../setup/kubernetes/aws.md) to support CVMs by
39+
[creating a nodegroup](https://eksctl.io/usage/managing-nodegroups/#creating-a-nodegroup-from-a-config-file)
40+
and updating your `eksctl` config spec.
41+
42+
1. Define your config file in the location of your choice (we've named the file
43+
`coder-node.yaml`, but you can call it whatever you'd like):
44+
45+
```yaml
46+
apiVersion: eksctl.io/v1alpha5
47+
kind: ClusterConfig
48+
49+
metadata:
50+
version: "1.21"
51+
name: <YOUR_CLUSTER_NAME>
52+
region: <YOUR_AWS_REGION>
53+
54+
nodeGroups:
55+
- name: coder-node-group
56+
amiFamily: Ubuntu2004
57+
ami: <your Ubuntu 20.04 AMI ID>
58+
```
59+
60+
> [See here for a list of EKS-compatible Ubuntu AMI IDs](https://cloud-images.ubuntu.com/docs/aws/eks/)
61+
62+
1. Create your nodegroup using the config file you just created (be sure to
63+
provide the correct file name):
64+
65+
```console
66+
eksctl create nodegroup --config-file=coder-node.yaml
67+
```
+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: Images
3+
description: Learn how to work with images for CVM-enabled workspaces.
4+
---
5+
6+
This article walks you through how to
7+
[configure images](../../../images/configure.md) for use with CVMs, as well as
8+
how to access images located in private [registries](../../registries/index.md).
9+
10+
## Image configuration
11+
12+
The following sections show how you can configure your image to include systemd
13+
and Docker for use in CVMs.
14+
15+
### systemd
16+
17+
If your image's OS distribution doesn't link the `systemd` init to `/sbin/init`,
18+
you'll need to do this manually in your Dockerfile.
19+
20+
The following snippet shows how you can specify `systemd` as the init in your
21+
image:
22+
23+
```Dockerfile
24+
FROM ubuntu:20.04
25+
RUN apt-get update && apt-get install -y \
26+
build-essential \
27+
systemd
28+
29+
# use systemd as the init
30+
RUN ln -s /lib/systemd/systemd /sbin/init
31+
```
32+
33+
When you start up a workspace, Coder checks for the presence of `/sbin/init` in
34+
your image. If it exists, then Coder uses it as the container entrypoint with a
35+
`PID` of 1.
36+
37+
### Docker
38+
39+
To add Docker, install the `docker` packages into your image. For a seamless
40+
experience, use [systemd](#systemd) and register the `docker` service so
41+
`dockerd` runs automatically during initialization.
42+
43+
The following snippet shows how your image can register the `docker` services in
44+
its Dockerfile.
45+
46+
```Dockerfile
47+
FROM ubuntu:20.04
48+
RUN apt-get update && apt-get install -y \
49+
build-essential \
50+
git \
51+
bash \
52+
docker.io \
53+
curl \
54+
sudo \
55+
systemd
56+
57+
# Enables Docker starting with systemd
58+
RUN systemctl enable docker
59+
60+
# use systemd as the init
61+
RUN ln -s /lib/systemd/systemd /sbin/init
62+
```
63+
64+
## Private registries
65+
66+
To use CVM workspaces with private images, you **must** create a
67+
[registry](../../registries/index.md#adding-a-registry) with authentication
68+
credentials. Private images that can be pulled directly by the node will not
69+
work with CVMs.
70+
71+
This restriction does not apply if you enable
72+
[cached CVMs](../cvms/management.md#enabling-cached-cvms).

0 commit comments

Comments
 (0)