#2. 开启匿名用户的可读权限
为了保证 流水线的 日志详情可以正常打开

#3. 配置Kubernetes cloud
$ kubectl -n devops describe serviceaccount jenkins-admin
$ kubectl -n devops describe secret [jenkins-admin-token-name]
配置Jenkins url为对应 {ServiceName}.{Namespace}:{TargetPort}
例如: http://jenkins.kube-lilin:8080/
注意: 这里使用的Kubernetes Namespace 注意要和创建的 ServiceAccount的 Namespace 保持一致。
{
Name: "docker",
Image: "kubelilin/kaniko-executor:debug",
WorkingDir: "/home/jenkins/agent",
CommandArr: []string{"cat"},
}
需要将Auth信息打包到/kaniko/.docker/config.json 文件中。
## 环境变量,这里以 hub.docker.com 为例:
{Key: "SGR_REGISTRY_ADDR", Value: "https://index.docker.io/v1/"},
{Key: "SGR_REGISTRY_AUTH", Value: "eWxxxxxxaaaxxMTI1MzMwMw=="}, // docker accont token
{Key: "SGR_REGISTRY_CONFIG", Value: "/kaniko/.docker"},
echo '{"auths": {"'$SGR_REGISTRY_ADDR'": {"auth": "'$SGR_REGISTRY_AUTH'"}}}' > $SGR_REGISTRY_CONFIG/config.json
Auth信息生成($SGR_REGISTRY_AUTH):
echo -n 用户名:密码 | base64
Checkout (串行) -> Compile (并行) -> Build (并行) -> Deploy (并行)
Content type
Image
Digest
sha256:06a726c87…
Size
34.1 MB
Last updated
over 3 years ago
docker pull kubelilin/kaniko-executor:v1.10.0-debug