|
| 1 | +# Installation on Kind Without OLM (Linux) |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +Before you begin, ensure you have the following tools installed: |
| 6 | + |
| 7 | +* **kubectl:** The Kubernetes command-line tool. |
| 8 | +* **kind:** A tool for running Kubernetes locally using Docker. |
| 9 | +* **Docker** (as a container runtime) |
| 10 | + |
| 11 | +## Steps |
| 12 | + |
| 13 | +### 1. Create Kind Cluster with Extra Port Mappings |
| 14 | + |
| 15 | +Create a Kind cluster with port mappings for HTTP and HTTPS traffic: |
| 16 | + |
| 17 | +```sh |
| 18 | +cat <<EOF | kind create cluster --config=- |
| 19 | +kind: Cluster |
| 20 | +apiVersion: kind.x-k8s.io/v1alpha4 |
| 21 | +nodes: |
| 22 | +- role: control-plane |
| 23 | + extraPortMappings: |
| 24 | + - containerPort: 80 |
| 25 | + hostPort: 80 |
| 26 | + protocol: TCP |
| 27 | + - containerPort: 443 |
| 28 | + hostPort: 443 |
| 29 | + protocol: TCP |
| 30 | +EOF |
| 31 | +``` |
| 32 | + |
| 33 | +### 2. Install NGINX Ingress Controller |
| 34 | + |
| 35 | +Install the NGINX ingress controller: |
| 36 | + |
| 37 | +```sh |
| 38 | +kubectl apply -f https://kind.sigs.k8s.io/examples/ingress/deploy-ingress-nginx.yaml |
| 39 | +``` |
| 40 | + |
| 41 | +Wait until the NGINX ingress controller pods are ready: |
| 42 | + |
| 43 | +```sh |
| 44 | +kubectl wait --namespace ingress-nginx \ |
| 45 | + --for=condition=ready pod \ |
| 46 | + --selector=app.kubernetes.io/component=controller \ |
| 47 | + --timeout=90s |
| 48 | +``` |
| 49 | + |
| 50 | +Redeploy the `ingress-nginx-controller` service to change its type from `LoadBalancer` to `NodePort`: |
| 51 | + |
| 52 | +```sh |
| 53 | +kubectl delete service ingress-nginx-controller -n ingress-nginx |
| 54 | +``` |
| 55 | + |
| 56 | +```sh |
| 57 | +kubectl expose deployment ingress-nginx-controller --name=ingress-nginx-controller --port=80 --type=NodePort -n ingress-nginx |
| 58 | +``` |
| 59 | + |
| 60 | +### 3. Create Namespace |
| 61 | + |
| 62 | +Create a dedicated namespace for the DevWorkspace Controller: |
| 63 | + |
| 64 | +```sh |
| 65 | +kubectl create namespace devworkspace-controller |
| 66 | +``` |
| 67 | + |
| 68 | +### 4. Install cert-manager |
| 69 | + |
| 70 | +Install cert-manager using the provided manifest: |
| 71 | + |
| 72 | +```sh |
| 73 | +kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.15.4/cert-manager.yaml |
| 74 | +``` |
| 75 | + |
| 76 | +Wait until cert-manager pods are ready: |
| 77 | + |
| 78 | +```sh |
| 79 | +kubectl wait --namespace cert-manager \ |
| 80 | + --timeout 90s \ |
| 81 | + --for=condition=ready pod \ |
| 82 | + --selector=app.kubernetes.io/instance=cert-manager |
| 83 | +``` |
| 84 | + |
| 85 | +### 5. Install the DevWorkspace Operator |
| 86 | + |
| 87 | +Install the DevWorkspace Operator from the given URL: |
| 88 | + |
| 89 | +```sh |
| 90 | +kubectl apply -f https://github.com/devfile/devworkspace-operator/raw/refs/tags/v0.31.2/deploy/deployment/kubernetes/combined.yaml |
| 91 | +``` |
| 92 | + |
| 93 | +Wait until the DevWorkspace Operator pods are ready: |
| 94 | + |
| 95 | +```sh |
| 96 | +kubectl wait --namespace devworkspace-controller \ |
| 97 | + --timeout 90s \ |
| 98 | + --for=condition=ready pod \ |
| 99 | + --selector=app.kubernetes.io/part-of=devworkspace-operator |
| 100 | +``` |
| 101 | + |
| 102 | +### 6. Create the DevWorkspace Operator Config |
| 103 | + |
| 104 | +#### 6.1 Get Kind Node IP |
| 105 | + |
| 106 | +Get the internal IP address of your Kind control-plane node: |
| 107 | + |
| 108 | +```sh |
| 109 | +kubectl get node -o wide |
| 110 | +``` |
| 111 | +Look for the `INTERNAL-IP` of the `kind-control-plane` node. Let's denote this as `<HOST_IP>`. You will use this IP in the next step. |
| 112 | + |
| 113 | +#### 6.2 Create the DevWorkspaceOperatorConfig |
| 114 | + |
| 115 | +Create the `DevWorkspaceOperatorConfig` resource, replacing `<HOST_IP>` with the IP you obtained in the previous step: |
| 116 | + |
| 117 | +```bash |
| 118 | +kubectl apply -f - <<EOF |
| 119 | +apiVersion: controller.devfile.io/v1alpha1 |
| 120 | +kind: DevWorkspaceOperatorConfig |
| 121 | +metadata: |
| 122 | + name: devworkspace-operator-config |
| 123 | + namespace: devworkspace-controller |
| 124 | +config: |
| 125 | + routing: |
| 126 | + clusterHostSuffix: "<HOST_IP>.nip.io" |
| 127 | +EOF |
| 128 | +``` |
| 129 | + |
| 130 | +### 7. Create a Sample DevWorkspace |
| 131 | + |
| 132 | +Create a sample DevWorkspace: |
| 133 | + |
| 134 | +```bash |
| 135 | +kubectl apply -f - <<EOF |
| 136 | +kind: DevWorkspace |
| 137 | +apiVersion: workspace.devfile.io/v1alpha2 |
| 138 | +metadata: |
| 139 | + name: git-clone-sample-devworkspace |
| 140 | +spec: |
| 141 | + started: true |
| 142 | + template: |
| 143 | + projects: |
| 144 | + - name: web-nodejs-sample |
| 145 | + git: |
| 146 | + remotes: |
| 147 | + origin: "https://github.com/che-samples/web-nodejs-sample.git" |
| 148 | + - name: devworkspace-operator |
| 149 | + git: |
| 150 | + checkoutFrom: |
| 151 | + remote: origin |
| 152 | + revision: 0.21.x |
| 153 | + remotes: |
| 154 | + origin: "https://github.com/devfile/devworkspace-operator.git" |
| 155 | + amisevsk: "https://github.com/amisevsk/devworkspace-operator.git" |
| 156 | + commands: |
| 157 | + - id: say-hello |
| 158 | + exec: |
| 159 | + component: che-code-runtime-description |
| 160 | + commandLine: echo "Hello from $(pwd)" |
| 161 | + workingDir: ${PROJECT_SOURCE}/app |
| 162 | + contributions: |
| 163 | + - name: che-code |
| 164 | + uri: https://eclipse-che.github.io/che-plugin-registry/main/v3/plugins/che-incubator/che-code/latest/devfile.yaml |
| 165 | + components: |
| 166 | + - name: che-code-runtime-description |
| 167 | + container: |
| 168 | + env: |
| 169 | + - name: CODE_HOST |
| 170 | + value: 0.0.0.0 |
| 171 | +EOF |
| 172 | +``` |
| 173 | + |
| 174 | +**Note:** The DevWorkspace creation may fail due to timeout if some container images are large and take longer than 5 minutes to pull. If the DevWorkspace fails, you can restart it by setting `spec.started` to `true`. Use the following command to re-trigger the DevWorkspace start: |
| 175 | + |
| 176 | +```bash |
| 177 | +kubectl patch devworkspace git-clone-sample-devworkspace -n default --type merge -p '{"spec": {"started": true}}' |
| 178 | +``` |
| 179 | +You can also check the DevWorkspace status by running: |
| 180 | +```sh |
| 181 | +kubectl get devworkspace -n default |
| 182 | +``` |
0 commit comments