我正在与jx,kubernetes和helm斗争。我在jx上运行一个Jenkinsfile,在环境目录中执行命令:
sh 'jx step helm build'
sh 'jx step helm apply'
成功完成并部署pods /创建部署等。但是,头盔列表为空。
当我执行helm install ...
或helm upgrade --install ...
之类的命令时,它会创建一个发布,并且头盔列表会显示该发布。
这是正确的行为吗?
更多详细信息:
EKS安装有:
eksctl create cluster --region eu-west-2 --name integration --version 1.12 \
--nodegroup-name integration-nodes \
--node-type t3.large \
--nodes 3 \
--nodes-min 1 \
--nodes-max 10 \
--node-ami auto \
--full-ecr-access \
--vpc-cidr "172.20.0.0/16"
然后,我使用一些kubectly apply
命令(不会共享文件)设置入口(外部和内部)。然后,我设置了路由和与vpc相关的内容。
JX已安装:
jx install --provider=eks --ingress-namespace='internal-ingress-nginx' \
--ingress-class='internal-nginx' \
--ingress-deployment='nginx-internal-ingress-controller' \
--ingress-service='internal-ingress-nginx' --on-premise \
--external-ip='#########' \
--git-api-token=######### \
--git-username=######### --no-default-environments=true
安装细节:
? Select Jenkins installation type: Static Jenkins Server and Jenkinsfiles
? Would you like wait and resolve this address to an IP address and use it for the domain? No
? Domain ###########
? Cloud Provider eks
? Would you like to register a wildcard DNS ALIAS to point at this ELB address? Yes
? Your custom DNS name: ###########
? Would you like to enable Long Term Storage? A bucket for provider eks will be created No
? local Git user for GitHub server: ###########
? Do you wish to use GitHub as the pipelines Git server: Yes
? A local Jenkins X versions repository already exists, pull the latest? Yes
? A local Jenkins X cloud environments repository already exists, recreate with latest? Yes
? Pick default workload build pack: Kubernetes Workloads: Automated CI+CD with GitOps Promotion
然后我设置了头盔:
kubectl apply -f tiller-rbac-config.yaml
helm init --service-account tiller
tiller-rbac-config.yaml为:
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: tiller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: tiller
namespace: kube-system
头盔版本说:
Client: &version.Version{SemVer:"v2.13.1", GitCommit:"618447cbf203d147601b4b9bd7f8c37a5d39fbb4", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.13.1", GitCommit:"618447cbf203d147601b4b9bd7f8c37a5d39fbb4", GitTreeState:"clean"}
jx版本说:
NAME VERSION
jx 2.0.258
jenkins x platform 2.0.330
Kubernetes cluster v1.12.6-eks-d69f1b
helm client Client: v2.13.1+g618447c
git git version 2.17.1
Operating System Ubuntu 18.04.2 LTS
应用程序是通过以下方式导入的:
jx import --branches="devel" --org ##### --disable-updatebot=true --git-api-token=##### --url git@github.com:#####.git
环境是通过以下方式创建的:
jx create env --git-url=##### --name=integration --label=Integration --domain=##### --namespace=jx-integration --promotion=Auto --git-username=##### --git-private --branches="master|devel|test"
答案 0 :(得分:5)
在更改日志中,似乎2.0.246版以来,无耕作模式已成为默认模式。
在Helm v2中,Helm依赖于其服务器端组件Tiller。 Jenkins X无耕种模式意味着,不使用Helm来安装图表,而是将Helm客户端仅用于模板化和生成Kubernetes清单。但是,这些清单通常是使用kubectl而不是helm / tiller施加的。
结果是,Helm将不知道此安装/发行版,因为它们是由kubectl制造的。因此,这就是为什么您无法获得使用Helm的版本列表的原因。这是预期的行为,如you can read on the Jenkins X docs。
--no-tiller的意思是切换掌舵以使用模板模式 意味着我们不再在内部使用helm install mychart来安装 图表,我们实际上使用头盔模板mychart代替 使用相同的舵图和标准舵的YAML 通过--set和values.yaml文件进行配置管理。
然后我们使用kubectl apply来应用YAML。
正如詹姆斯·斯特拉坎(James Strachan)在评论中提到的那样,当使用免耕模式时,you can view your deployments using jx step helm list