├── .editorconfig ├── README.md ├── LICENSE └── kubernetes.yml /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.{yml,yaml}] 13 | indent_size = 2 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | kubernetes-che 2 | ============== 3 | 4 | Example deploying **[Eclipse Che](https://github.com/eclipse/che/)** on a [Kubernetes](http://kubernetes.io/) cluster. 5 | So what you get is a Che server running on your cluster behind [SPDY Proxy](https://github.com/igrigorik/node-spdyproxy) to handle authencation and encryption. 6 | 7 | Note: Currently alpha state; barely tested. 8 | 9 | 10 | Usage 11 | ----- 12 | 13 | ### Deployment 14 | 15 | 1. You need a running [Kubernetes](http://kubernetes.io/) cluster (for example [Google Container Engine](https://cloud.google.com/container-engine/)). 16 | 2. Edit `kubernetes.yml` and see the `TODO`; update with your values. 17 | 3. Run `kubectl apply -f kubernetes.yml` 18 | 4. Follow client-side set up (see below). 19 | 20 | ### Client-side set up 21 | 22 | For **Chrome** install [SwitchyOmega](https://chrome.google.com/webstore/detail/proxy-switchyomega/padekgcemlokbadohgkifijomclgjgif). 23 | Then add a PAC Profile with the [PAC Script](https://en.wikipedia.org/wiki/Proxy_auto-config) below: 24 | 25 | function FindProxyForURL(url, host) { 26 | if (dnsDomainIs(host, "che")) { 27 | # TODO: Replace with your host/IP pointing to SPDY Proxy. 28 | return "HTTPS che.example.com:44300"; 29 | } 30 | 31 | return "DIRECT"; 32 | } 33 | 34 | Click the lock to set username/password according to values you've set in `kubernetes.yml`. 35 | 36 | Supposing you've set up your DNS to point to the Ingress Controller external IP 37 | (or actually to SPDY Proxy) and the SSL certificate of that host is trusted; 38 | you should now be able to connect to `http://che/`. 39 | 40 | 41 | How it works 42 | ------------ 43 | 44 | The beginning of `kubernetes.yml` is to get a valid TLS certificate. It sets up an Ingress Controller 45 | which, if you don't already have one, can be used for other services running on your cluster. 46 | It's not critical for the system to work, but you need a valid certificate when trying proxy through 47 | SPDY Proxy else your browser will refuse to use it. 48 | 49 | SPDY Proxy is used to add **authentication, encryption**, and access che running on your cluster. 50 | The rules are set up so that it's only used when trying to access Che. 51 | 52 | The critical part is that `che` resolves to the container running the Docker server used by the Che server, 53 | from withing your cluster (and thus also from outside your cluster via SPDY Proxy). 54 | 55 | It runs the Che server and links it to a running Docker daemon (Docker-in-Docker is running also on Kubernetes). 56 | 57 | ### Isn't Docker-in-Docker discouraged? 58 | 59 | The [original blog post](https://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/) is partially outdated. The current [`docker:dind`](https://hub.docker.com/_/docker) is slow (because it uses `--storage-driver=vfs`) but should not corrupt data regardless of the underlying file system. 60 | 61 | It's required here and desired for the following reasons: 62 | 63 | * CRITICAL: Kubernetes spawns on multiple machines but you need to have Docker and Che on the same host to be able to mount the same directory on both. These volume mounts are required by Che: 64 | - `lib-copy` used to bootstrap a workspace 65 | - `storage` used to access some settings like SSH keys 66 | - `workspaces` used to run `docker run -v ...` from within a Che workspace 67 | * Cleaner: Deleting the Pod or if it fails health checks it'll not block or pollute the file system of Kubernetes itself. 68 | * Provide a simple way to access the Docker host from within Kubernetes cluster (passed via `--remote:che` to Che). 69 | 70 | What could be improved 71 | ---------------------- 72 | 73 | * Requires clients to setup and use that SPDY Proxy (at least until [eclipse/che#1560](https://github.com/eclipse/che/issues/1560) is fixed) 74 | * Long lived HTTP requests like the terminal, or possibly other parts, seem to disconnect after a while if there was no I/O. Not tested which part is responsible for this issue. 75 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /kubernetes.yml: -------------------------------------------------------------------------------- 1 | # Ingress Controller LoadBalancer. 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: nginx-ingress 6 | spec: 7 | type: LoadBalancer 8 | # You can select a static IP for your Ingress controller so your can use DNS. 9 | #loadBalancerIP: 10.10.10.10 10 | ports: 11 | - port: 80 12 | name: http 13 | - port: 443 14 | name: https 15 | selector: 16 | name: nginx-ingress-controller 17 | --- 18 | # Nginx Ingress Controller 19 | apiVersion: extensions/v1beta1 20 | kind: Deployment 21 | metadata: 22 | name: nginx-ingress-controller 23 | spec: 24 | revisionHistoryLimit: 3 25 | replicas: 1 26 | template: 27 | metadata: 28 | labels: 29 | name: nginx-ingress-controller 30 | spec: 31 | terminationGracePeriodSeconds: 60 32 | containers: 33 | - name: nginx-ingress-controller 34 | image: gcr.io/google_containers/nginx-ingress-controller:0.8.3 35 | imagePullPolicy: Always 36 | args: 37 | - /nginx-ingress-controller 38 | # Ingress controller redirects here for any unknown subdomain, that service should: 39 | # - Serve a HTTP/404 on / 40 | # - Serve a HTTP/200 on /healthz 41 | - --default-backend-service=default/default-http-backend 42 | # Use downward API 43 | env: 44 | - name: POD_NAME 45 | valueFrom: 46 | fieldRef: 47 | fieldPath: metadata.name 48 | - name: POD_NAMESPACE 49 | valueFrom: 50 | fieldRef: 51 | fieldPath: metadata.namespace 52 | ports: 53 | - containerPort: 80 54 | - containerPort: 443 55 | # (Optional) Expose 18080 to access Nginx stats in url /nginx-status: 56 | #- containerPort: 18080 57 | volumeMounts: 58 | - name: tls-dhparam-vol 59 | mountPath: /etc/nginx-ssl/dhparam 60 | livenessProbe: 61 | httpGet: 62 | path: /healthz 63 | port: 10254 64 | scheme: HTTP 65 | initialDelaySeconds: 30 66 | timeoutSeconds: 5 67 | resources: 68 | requests: 69 | cpu: 5m 70 | memory: "100Mi" 71 | limits: 72 | memory: "500Mi" 73 | volumes: 74 | - name: tls-dhparam-vol 75 | secret: 76 | secretName: ingress-tls-dhparam 77 | --- 78 | # Retrieves and updates TLS certificates from LetsEncrypt.org (ACME provider). 79 | apiVersion: extensions/v1beta1 80 | kind: Deployment 81 | metadata: 82 | name: kube-lego 83 | spec: 84 | revisionHistoryLimit: 3 85 | replicas: 1 86 | template: 87 | metadata: 88 | labels: 89 | name: kube-lego 90 | # Required for auto-created kube-lego-nginx service to work. 91 | app: kube-lego 92 | spec: 93 | containers: 94 | - name: kube-lego 95 | image: jetstack/kube-lego:0.1.2 96 | imagePullPolicy: Always 97 | ports: 98 | - containerPort: 8080 99 | env: 100 | - name: LEGO_EMAIL 101 | # TODO: Put your e-mail here. 102 | value: example@example.com 103 | - name: LEGO_URL 104 | # Use Let's Encrypt production API URL (instead of default staging environment): 105 | value: "https://acme-v01.api.letsencrypt.org/directory" 106 | - name: LEGO_NAMESPACE 107 | valueFrom: 108 | fieldRef: 109 | fieldPath: metadata.namespace 110 | - name: LEGO_POD_IP 111 | valueFrom: 112 | fieldRef: 113 | fieldPath: status.podIP 114 | readinessProbe: 115 | httpGet: 116 | path: /healthz 117 | port: 8080 118 | initialDelaySeconds: 5 119 | timeoutSeconds: 1 120 | livenessProbe: 121 | httpGet: 122 | path: /healthz 123 | port: 8080 124 | initialDelaySeconds: 5 125 | timeoutSeconds: 1 126 | resources: 127 | requests: 128 | cpu: 5m 129 | memory: "10Mi" 130 | limits: 131 | cpu: 50m 132 | memory: "100Mi" 133 | --- 134 | # Default web server if no Ingress rule applies. 135 | apiVersion: v1 136 | kind: Service 137 | metadata: 138 | name: default-http-backend 139 | spec: 140 | ports: 141 | - port: 80 142 | targetPort: 8080 143 | selector: 144 | name: default-http-backend 145 | --- 146 | apiVersion: extensions/v1beta1 147 | kind: Deployment 148 | metadata: 149 | name: default-http-backend 150 | spec: 151 | revisionHistoryLimit: 3 152 | replicas: 1 153 | template: 154 | metadata: 155 | labels: 156 | name: default-http-backend 157 | spec: 158 | terminationGracePeriodSeconds: 60 159 | containers: 160 | - name: default-http-backend 161 | image: gcr.io/google_containers/defaultbackend:1.0 162 | livenessProbe: 163 | httpGet: 164 | path: /healthz 165 | port: 8080 166 | scheme: HTTP 167 | initialDelaySeconds: 30 168 | timeoutSeconds: 5 169 | ports: 170 | - containerPort: 8080 171 | resources: 172 | limits: 173 | cpu: 10m 174 | memory: 20Mi 175 | requests: 176 | cpu: 10m 177 | memory: 20Mi 178 | volumeMounts: 179 | # Security hack, see https://github.com/kubernetes/kubernetes/issues/16779 180 | - name: no-service-account 181 | mountPath: /var/run/secrets/kubernetes.io/serviceaccount 182 | readOnly: true 183 | volumes: 184 | - name: no-service-account 185 | emptyDir: {} 186 | --- 187 | # We only need this Ingress rule to generate a TLS certificate. 188 | apiVersion: extensions/v1beta1 189 | kind: Ingress 190 | metadata: 191 | name: che-ingress 192 | annotations: 193 | kubernetes.io/ingress.class: "nginx" 194 | kubernetes.io/tls-acme: "true" 195 | spec: 196 | tls: 197 | - secretName: che-tls-certificate 198 | hosts: 199 | # TODO: Put your hostname 200 | - che.example.com 201 | rules: 202 | # TODO: Put your hostname 203 | - host: che.example.com 204 | --- 205 | apiVersion: v1 206 | kind: Service 207 | metadata: 208 | name: spdyproxy 209 | spec: 210 | type: LoadBalancer 211 | # Should be the same IP as the Ingress controller. 212 | # loadBalancerIP: 10.10.10.10 213 | ports: 214 | - port: 44300 215 | selector: 216 | app: che 217 | --- 218 | apiVersion: extensions/v1beta1 219 | kind: Deployment 220 | metadata: 221 | name: che 222 | spec: 223 | revisionHistoryLimit: 3 224 | replicas: 1 225 | # Pod template (contains same fields as a normal Pod) 226 | template: 227 | metadata: 228 | labels: 229 | app: che 230 | spec: 231 | # Resolve "che" to localhost on these containers. 232 | # This is so that trying to access http://che/ through speedy will 233 | # let SPDY point to localhost, and that way all ports opened by 234 | # Docker:DinD will also be accessible, e.g. http://che:32650. 235 | hostname: che 236 | terminationGracePeriodSeconds: 60 237 | containers: 238 | - name: spdyproxy 239 | image: wernight/spdyproxy 240 | imagePullPolicy: Always 241 | args: 242 | - --key=/var/run/secrets/tls/tls.key 243 | - --cert=/var/run/secrets/tls/tls.crt 244 | # TODO: Set authentication. 245 | #- --user=MY_USERNAME 246 | #- --pass=MY_PASSWORD 247 | - --verbose 248 | ports: 249 | - containerPort: 44300 250 | readinessProbe: 251 | tcpSocket: 252 | port: 44300 253 | livenessProbe: 254 | tcpSocket: 255 | port: 44300 256 | initialDelaySeconds: 60 257 | resources: 258 | requests: 259 | cpu: 5m 260 | memory: "10Mi" 261 | limits: 262 | memory: "100Mi" 263 | volumeMounts: 264 | - name: tls-vol 265 | mountPath: /var/run/secrets/tls 266 | readOnly: true 267 | # Security hack, see https://github.com/kubernetes/kubernetes/issues/16779 268 | - name: no-service-account 269 | mountPath: /var/run/secrets/kubernetes.io/serviceaccount 270 | readOnly: true 271 | - name: che-server 272 | # See documentation on https://eclipse.org/che/docs/setup/docker/index.html 273 | # Latest tags: https://hub.docker.com/r/eclipse/che-server/tags/ 274 | image: eclipse/che-server:5.7.0 275 | env: 276 | - name: CHE_IP 277 | value: che # External hostname. 278 | - name: CHE_PORT 279 | value: "80" 280 | - name: DOCKER_HOST 281 | value: tcp://che:2375 282 | # Asks workspaces to be persisted under storage so that 283 | # only on directory is needed to persist Che data. 284 | - name: CHE_WORKSPACE_STORAGE 285 | value: /projects 286 | # Uncomment to give access to a Google Container Registry 287 | # See http://stackoverflow.com/a/43140504/167897 to see 288 | # we cnnot use the UI because GCE passwords are too long 289 | # See https://github.com/codenvy/codenvy/issues/1948 290 | #- name: CHE_DOCKER_REGISTRY_AUTH_REGISTRY1_URL 291 | # value: gcr.io 292 | #- name: CHE_DOCKER_REGISTRY_AUTH_REGISTRY1_USERNAME 293 | # value: _json_key 294 | #- name: CHE_DOCKER_REGISTRY_AUTH_REGISTRY1_PASSWORD 295 | # valueFrom: 296 | # secretKeyRef: 297 | # name: container-registry-account 298 | # key: password 299 | ports: 300 | - containerPort: 80 301 | readinessProbe: 302 | tcpSocket: 303 | port: 80 304 | # See also https://github.com/eclipse/che/issues/2761 305 | # httpGet: 306 | # path: /dashboard/ 307 | periodSeconds: 10 308 | livenessProbe: 309 | tcpSocket: 310 | port: 80 311 | # httpGet: 312 | # path: /dashboard/ 313 | initialDelaySeconds: 60 314 | periodSeconds: 30 315 | lifecycle: 316 | preStop: 317 | exec: 318 | # See https://github.com/eclipse/che-dockerfiles/blob/master/che-launcher/launcher_cmds.sh 319 | command: ["/home/user/che/bin/che.sh", "-c", "-s:uid", "stop"] 320 | resources: 321 | requests: 322 | cpu: 5m 323 | memory: "300Mi" 324 | limits: 325 | memory: "1.0Gi" 326 | volumeMounts: 327 | - name: lib-vol 328 | mountPath: /home/user/che/lib-copy 329 | - name: storage-vol 330 | mountPath: /home/user/che/storage 331 | # Security hack, see https://github.com/kubernetes/kubernetes/issues/16779 332 | - name: no-service-account 333 | mountPath: /var/run/secrets/kubernetes.io/serviceaccount 334 | readOnly: true 335 | - name: docker-dind 336 | image: docker:dind 337 | # TODO: You may add arg `--storage-driver=` using the same driver as your host 338 | # (which can be seen under `Storage Driver` in the output of `docker info`) 339 | # for your Docker to be faster. 340 | imagePullPolicy: Always 341 | resources: 342 | requests: 343 | cpu: 5m 344 | memory: "1.0Gi" 345 | limits: 346 | # TODO: Remove or adjust to whatever you feel should be max. 347 | cpu: 700m 348 | memory: "3.0Gi" 349 | securityContext: 350 | privileged: true 351 | readinessProbe: 352 | exec: 353 | command: ["docker", "info"] 354 | livenessProbe: 355 | exec: 356 | command: ["docker", "info"] 357 | periodSeconds: 30 358 | lifecycle: 359 | preStop: 360 | exec: 361 | # Wait a little so that Che server can gracefully exit. 362 | command: ["sleep", "30"] 363 | volumeMounts: 364 | - name: lib-vol 365 | mountPath: /home/user/che/lib 366 | # Mounting storage is required for SSH key to work for example. 367 | # Mounting also workspaces is optional for Che but required if you want to mount 368 | # workspace directories like "docker run -v $PWD:..." from within a Che workspace. 369 | - name: storage-vol 370 | mountPath: /home/user/che/storage 371 | - name: docker-vol 372 | mountPath: /var/lib/docker 373 | # Security hack, see https://github.com/kubernetes/kubernetes/issues/16779 374 | - name: no-service-account 375 | mountPath: /var/run/secrets/kubernetes.io/serviceaccount 376 | readOnly: true 377 | volumes: 378 | - name: tls-vol 379 | secret: 380 | secretName: che-tls-certificate 381 | - name: lib-vol 382 | emptyDir: {} 383 | - name: storage-vol 384 | # TODO: You may want to use persistent disk instead. 385 | emptyDir: {} 386 | - name: docker-vol 387 | # TODO: You may want to use persistent disk instead to preserve Docker images cache. 388 | emptyDir: {} 389 | - name: no-service-account 390 | emptyDir: {} 391 | --------------------------------------------------------------------------------