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

Initial support for deploying Che to Kubernetes using Helm charts #8715

Merged
merged 9 commits into from
Feb 16, 2018
Merged

Initial support for deploying Che to Kubernetes using Helm charts #8715

merged 9 commits into from
Feb 16, 2018

Conversation

perspectivus1
Copy link
Contributor

What does this PR do?

Enable deploying Che to Kubernetes using Helm charts.

What issues does this PR fix or reference?

One of the leftover tasks for SPI Kubernetes infrastructure issue

Release Notes

Docs PR

Signed-off-by: Eyal Barlev <perspectivus@gmail.com>
@codenvy-ci
Copy link

Can one of the admins verify this patch?

1 similar comment
@codenvy-ci
Copy link

Can one of the admins verify this patch?

@codenvy-ci
Copy link

Can one of the admins verify this patch?

@skabashnyuk
Copy link
Contributor

@eivantsov do you think we need some docs update with this pr?

@benoitf benoitf added status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. kind/enhancement A feature request - must adhere to the feature request template. kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed. labels Feb 12, 2018
CHE_INFRA_KUBERNETES_NAMESPACE: ""
CHE_INFRA_KUBERNETES_TRUST__CERTS: "false"
CHE_INFRA_KUBERNETES_PVC_STRATEGY: "common"
CHE_INFRA_KUBERNETES_PVC_PRECREATE__SUBPATHS: "true"
Copy link
Member

Choose a reason for hiding this comment

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

Please change it to false according to #8726

kubernetes.io/tls-acme: "true"
{{ else }}
nginx.ingress.kubernetes.io/ssl-redirect: "false"
ingress.kubernetes.io/proxy-read-timeout: "3600"
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure that there is no need to update read and connect timeout when TLS is disabled?

CHE_PREDEFINED_STACKS_RELOAD__ON__START: "false"
JAVA_OPTS: "-XX:MaxRAMFraction=2 -XX:+UseParallelGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20 -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dsun.zip.disableMemoryMapping=true -Xms20m "
CHE_WORKSPACE_AUTO_START: "false"
CHE_INFRA_KUBERNETES_INGRESS_ANNOTATIONS__JSON: '{"nginx.ingress.kubernetes.io/rewrite-target": "/","nginx.ingress.kubernetes.io/ssl-redirect": "false","nginx.ingress.kubernetes.io/proxy-connect-timeout": "3600","nginx.ingress.kubernetes.io/proxy-read-timeout": "3600"}'
Copy link
Member

Choose a reason for hiding this comment

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

Should not this value be updated according to the value of .Values.tlsEnabled configuration property?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should, but we will tackle TLS once we fully support host-based routing for workspace ingresses.

Copy link
Member

Choose a reason for hiding this comment

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

OK then

@sleshchenko
Copy link
Member

I tried to upgrade Che with Help when tlsEnabled is true and I got the following error
screenshot_20180212_155251
Can you point me what I did wrong? I use minikube v0.25.0.

kubernetes.io/tls-acme: "true"
{{ else }}
nginx.ingress.kubernetes.io/ssl-redirect: "false"
ingress.kubernetes.io/proxy-read-timeout: "3600"
Copy link

@garagatyi garagatyi Feb 13, 2018

Choose a reason for hiding this comment

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

Shouldn't ingress.kubernetes.io/proxy-read-timeout and connect timeout be prefixed with nginx as other nginx specific annotations?

Copy link

@garagatyi garagatyi left a comment

Choose a reason for hiding this comment

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

Looks good but I haven't checked that it runs myself

Copy link
Contributor

@l0rd l0rd left a comment

Choose a reason for hiding this comment

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

@perspectivus1 thanks for this PR! Why have you created a new folder che-kubernetes-helm? Why not using kubernetes folder itself. Helm should be the default way to deploy Che on kube anyway.

@perspectivus1
Copy link
Contributor Author

TLS is not yet working for workspace ingresses. We should first support host-based routing. Hope to get to it in a few days.

The issue @sleshchenko encountered when trying to upgrade is a bug in helm that was fixed a couple of days ago in release 2.8.1.

After downloading the new helm executable, run this command to update tiller:

helm init --upgrade --service-account tiller

@l0rd, I agree that helm should be the default way to deploy Che to Kubernetes. First, the name of the directory must match the name of the chart in Chart.yaml and 'kubernetes' is not descriptive enough if we ever intend to upload this chart to a Helm repository. I guess that once this PR is merged we can remove the plain kubectl deployment.

- Otherwise, you may have to modify the KUBECONFIG environment variable and then type `kubectl config use-context <my-context>`
- Install tiller on your cluster:
- Create a tiller serviceAccount and bind it to the almighty cluster-admin role: `kubectl apply -f ./tiller-rbac.yaml`
- Install tiller itself: `helm init --service-acount tiller`
Copy link
Contributor

Choose a reason for hiding this comment

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

s/acount/account/

- Ensure that you have an NGINX-based ingress controller. Note: This is the default ingress controller on Minikube. You can start it with `minikube addons enable ingress`
- DNS discovery should be enabled. Note: It is enabled by default in minikube.
### Deployment Process
- Obtain the address of your Kubernetes cluser:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should say here that the address is needed to set the value of cheDomain in values.yaml

- Override default values by changing the values.yaml file and then typing:

```bash
helm upgrade --install <my-che-installation> ./
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be interesting to add the minikube specific command:

helm upgrade --install <my-che-installation> --set ingress.cheDomain=$(minikube ip).nip.io ./

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In my opinion, the beauty of helm is that it works seamlessly for any Kubernetes cluster (minikube or other). We could add a script file that automates the deployment specifically for minikube. What do you think?


```bash
helm upgrade --install <my-che-installation> --namespace <my-che-namespace> --set ingress.cheDomain=<my-hostname> --set cheImage=<my-image> ./
```
Copy link
Contributor

Choose a reason for hiding this comment

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

It may be interesting to add the command to uninstall Che:

helm delete <my-che-installation>

serviceName: che-host
servicePort: 8080
path: /
{{- if .Values.isHostBased }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that this if condition should be removed: it's already done in cheHost template and it's not consistent with how CHE_HOST and CHE_APIare defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're working on improving host-based routing support in Kubernetes. We'll cleanup the ingress in the process.

name: tiller-role-binding
roleRef:
kind: ClusterRole
name: cluster-admin
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to add the service account tiller? And why should it have cluster-admin role?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Basically, it's because tiller needs to create Kubernetes resources in namespace other than the namespace in which tiller is installed. Here are more details.

spec:
containers:
- env:
- name: CHE_DOMAIN
Copy link
Member

Choose a reason for hiding this comment

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

Is it used by the Che Server?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is in prep for host-based routing in workspaces

Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@l0rd l0rd left a comment

Choose a reason for hiding this comment

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

@perspectivus1 thanks for the updates and for your answers. This PR is an important step for k8s support. Are you ok if we merge this PR now?

@perspectivus1
Copy link
Contributor Author

Yes. Please go ahead with the merge.

@l0rd l0rd merged commit 177e7a0 into eclipse-che:master Feb 16, 2018
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Feb 23, 2018
@benoitf benoitf added this to the 6.2.0 milestone Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template. kind/epic A long-lived, PM-driven feature request. Must include a checklist of items that must be completed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants