前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >腾讯云部署Eclipse Che(云原生IDE)

腾讯云部署Eclipse Che(云原生IDE)

原创
作者头像
赵C
修改2020-10-12 18:15:04
3.2K0
修改2020-10-12 18:15:04
举报
文章被收录于专栏:云原生开发云原生开发

准备工作

  • 已经创建了一个腾讯云容器服务集群
  • 配置好kubectl客户端
  • 已经有一个腾讯云(DNSPod)解析的域名

安装chectl

$ bash <(curl -sL  https://www.eclipse.org/che/chectl/)

安装NGINX Ingress Controller

详细安装过程见:https://kubernetes.github.io/ingress-nginx/deploy/

这里需要注意的是是controller使用的镜像地址国内无法访问,需要换成你自己的镜像地址,可以将镜像翻墙下载,然后上传到腾讯云容器服务的镜像仓库里。

安装cert-manager

cert-manager是原生的Kubernetes证书管理控制器。 它可以帮助从各种证书机构颁发证书,例如Let's Encrypt,HashiCorp Vault,Venafi,简单的签名密钥对或生成自签名证书。

它将确保证书有效并且是最新的,并在到期前尝试在配置的时间续订证书。

# Kubernetes 1.16+
$ kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.0.2/cert-manager.yaml

# Kubernetes <1.16
$ kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.0.2/cert-manager-legacy.yaml

本文只要确保会使用即可,有时间再详细介绍一下cert-manager

安装dnspod webhook

申请dnspod的api调用凭证

在安装dnspod webhook之前,需要新申请dnspod调用api接口的id和和token,首先登陆dnspod管理控制台(使用腾讯云账号即可登陆),如下图所示:

dnspodconsole.jpg
dnspodconsole.jpg

进入“密钥管理”页面,点击“创建密钥”。

keymanager.jpg
keymanager.jpg

在创建“创建密钥”页面,输入密钥名称,点击“确定”即可。

createkey.jpg
createkey.jpg

创建成功后,如下图所示:

createkeysuccess.jpg
createkeysuccess.jpg

复制保存ID和Token、复制保存ID和Token、复制保存ID和Token,后面将用到。

安装dnspod webhook

下载代码:

$ git clone https://github.com/qqshfox/cert-manager-webhook-dnspod.git

使用helm安装:

$ cd cert-manager-webhook-dnspod
$ helm install --name cert-manager-webhook-dnspod ./deploy/cert-manager-webhook-dnspod \
    --namespace <NAMESPACE-WHICH-CERT-MANAGER-INSTALLED> \
    --set groupName=<GROUP_NAME> \
    --set secrets.apiID=<DNSPOD_API_ID>,secrets.apiToken=<DNSPOD_API_TOKEN> \
    --set clusterIssuer.enabled=true,clusterIssuer.email=<EMAIL_ADDRESS>

注意:上面的命令中中,namespace配置为che,GROUP_NAME建议使用acme.xxx.com这样的唯一标识即可,DNSPOD_API_ID和DNSPOD_API_TOKEN为上一步申请的api调用凭证,EMAIL_ADDRESS配置为您常用地址即可,在证书过期的时候会发送提醒之类到这个邮箱地址。

安装完后,webhook将自动帮您创建一个cluster issuer,如下所示:

[root@VM_0_10_centos cheworkspace]# kubectl get clusterissuer
NAME                                         READY   AGE
cert-manager-webhook-dnspod-cluster-issuer   True    14h

查看yaml格式,如下:

apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  ……
  name: cert-manager-webhook-dnspod-cluster-issuer
  ……
spec:
  acme:
    email: zhcj11118@126.com
    preferredChain: ""
    privateKeySecretRef:
      name: cert-manager-webhook-dnspod-letsencrypt
    server: https://acme-v02.api.letsencrypt.org/directory
    solvers:
    - dns01:
        webhook:
          config:
            apiID: 184422
            apiTokenSecretRef:
              key: api-token
              name: cert-manager-webhook-dnspod-secret
          groupName: acme.venusource.com
          solverName: dnspod

申请ssl证书

eclipse che要求使用一个泛域名来自动配置相关的服务及实现多租户模式,我们需要解析一个*.xxx.xxx.cn这样的域名到nginx controller,所以cert-manager申请证书时,必须使用dns01方式认证域名所有权,HTTP方式不支持泛域名的所有权认证。请确保您在腾讯云申请了相关了域名。

新建文件che-certificate.yaml,内容如下:

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: che-certificate
  namespace: che
spec:
  dnsNames:
    - 'ide.gwunion.cn'
    - '*.ide.gwunion.cn'
  secretName: che-tls
  issuerRef:
    name: cert-manager-webhook-dnspod-cluster-issuer
    kind: ClusterIssuer

系统将调用letsencrypt的acme的接口为我们的域名申请证书。

注意:这里的secretName必须为che-tls,chectl在安装时会检查,如果有有che-tls这个secret就不在自动创建一个自签名的证书,直接使用che-tls。

执行下面的命令查看证书申请情况

kubectl describe Certificate che-certificate -n che

等待通过dns方式对域名进行所有权认证,一段1-2分钟内证书就申请完毕,并保存到名称为che-tls的secret内。

安装eclipse che

安装之前,请确保您使用的域名*.xxx.xxx.com已经解析到ingress nginx controller的IP地址,查看IP地址可执行下面的命令查看:

kubectl get services --namespace ingress-nginx

IP地址为EXTERNAL-IP字段,请在腾讯云域名解析控制台或dnspod域名解析控制台解析*.xxx.xxx.com的A记录到EXTERNAL-IP。

$ chectl server:start -a helm -b ide.gwunion.cn -p k8s --multiuser --k8spodreadytimeout=13000000 --k8spodwaittimeout=30000000
› Current Kubernetes context: 'cls-8437x8wt-context-default'
  ✔ Verify Kubernetes API...OK
  ✔ 👀  Looking for an already existing Eclipse Che instance
    ✔ Verify if Eclipse Che is deployed into namespace "che"...it is not
  ✔ ✈️  Kubernetes preflight checklist
    ✔ Verify if kubectl is installed
    ✔ Verify remote kubernetes status...done.
    ✔ Check Kubernetes version: Found v1.18.4-tke.2.
    ✔ Verify domain is set...set to ide.gwunion.cn.
    ↓ Check if cluster accessible [skipped]
  ✔ Start following logs
    ↓ Start following Operator logs [skipped]
    ✔ Start following Eclipse Che logs...done
    ✔ Start following Postgres logs...done
    ✔ Start following Keycloak logs...done
    ✔ Start following Plugin registry logs...done
    ✔ Start following Devfile registry logs...done
  ✔ Start following events
    ✔ Start following namespace events...done
 ›   Warning: Consider using the more reliable 'OLM' installer when deploying a stable release of Eclipse Che (--installer=olm).
  ✔ 🏃‍  Running Helm to install Eclipse Che
    ✔ Verify if helm is installed
    ✔ Check Helm Version: Found v3.3.1+g249e521
    ✔ Create Namespace (che)...does already exist.
    ✔ Check Eclipse Che TLS certificate...TLS certificate secret found
    ✔ Check Cluster Role Binding...done.
    ✔ Preparing Eclipse Che Helm Chart...done.
    ✔ Updating Helm Chart dependencies...done.
    ✔ Deploying Eclipse Che Helm Chart...done.
  ✔ ✅  Post installation checklist
    ✔ PostgreSQL pod bootstrap
      ✔ scheduling...done.
      ✔ downloading images...done.
      ✔ starting...done.
    ✔ Devfile registry pod bootstrap
      ✔ scheduling...done.
      ✔ downloading images...done.
      ✔ starting...done.
    ✔ Plugin registry pod bootstrap
      ✔ scheduling...done.
      ✔ downloading images...done.
      ✔ starting...done.
    ✔ Eclipse Che pod bootstrap
      ✔ scheduling...done.
      ✔ downloading images...done.
      ✔ starting...done.
    ✔ Retrieving Eclipse Che server URL... https://che-che.ide.gwunion.cn
    ✔ Eclipse Che status check
  ✔ Show important messages
    ✔ Autogenerated Keycloak credentials are: "admin:iZ245VK5RUHV"
Command server:start has completed successfully.

这里简单说明一下chectl几个参数:

  • -a helm 为安装方式使用helm chart
  • -b ide.gwunion.cn 为eclipse che使用的访问域名
  • -p k8s 安装平台为独立安装的k8s平台
  • --multiuser 支持多用户
  • --k8spodreadytimeout=13000000 等待pod为ready状态的超时时长
  • --k8spodwaittimeout=30000000 等待pod启动的超时时长,为什么要配置那么长时间,主要是由于国内网络状态太差,拉取镜像的时间较长,所以越大越好。

安装完成后,即可通过 https://che-che.xxx.com访问您的eclipse che云开发ide环境了,如下图所示:

chelogin.jpg
chelogin.jpg

首次需要注册用户,然后登陆控制台即可,让您的团队尽情的享用云原生IDE吧。

chedashboard.jpg
chedashboard.jpg
cheide.jpg
cheide.jpg

以后不用给你的团队配笔记本电脑了,人手一个ipad,性能可按需配置,就像下面这样:

ipadworkstation.jpg
ipadworkstation.jpg

后续的优化提升

由于目前平台所有镜像都使用国外的镜像,下载速度较慢,建议在生产环境使用将镜像本地化,可以使用腾讯云的容器镜像服务。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 准备工作
  • 安装chectl
  • 安装NGINX Ingress Controller
  • 安装cert-manager
  • 安装dnspod webhook
    • 申请dnspod的api调用凭证
      • 安装dnspod webhook
      • 申请ssl证书
      • 安装eclipse che
      • 后续的优化提升
      相关产品与服务
      容器服务
      腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
      领券
      问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档