我有点困惑如何skaffold
在我的情况下正确设置。这是我的skaffold.yaml
:
apiVersion: skaffold/v2beta17
kind: Config
build:
tagPolicy:
gitCommit: {}
artifacts:
- image: zero-x/spring-cloud-kubernetes/config-map-it
custom:
buildCommand: ./build.sh
local:
useDockerCLI: false
useBuildkit: false
push: false
deploy:
helm:
releases:
- name: config-map-it
chartPath: src/main/helm
artifactOverrides:
# skaffold will override this with a different tag
image: zero-x/spring-cloud-kubernetes/config-map-it
valuesFiles:
- src/main/helm/values.yaml
wait: true
setValues:
namespace: spring-k8s
在build.sh
:
#!/usr/bin/env bash
# build jar only, no tests, no chart
.././gradlew clean build bootjar -x test -x helmChartBuild --quiet
docker build --quiet --build-arg JAR_FILE='build/libs/*.jar' -t ${IMAGE} .
${IMAGE}
由 提供skaffold
。
所以我需要构建第jar
一个,将其打包到映像中并进行部署。我依次调用两件事:
skaffold build // builds the image just fine
skaffold deploy
失败:
You either need to:
run [skaffold deploy] with [--images TAG] for each pre-built artifact
or [skaffold run] instead, to let Skaffold build, tag and deploy artifacts.
no tag provided for image [zero-x/spring-cloud-kubernetes/config-map-it]
这里发生了什么?没有太多的抨击,我无法让这个工作。至少可以说,关于 skaffold 以及如何正确做事的教程和文档很少。
编辑
所以我确实在做:
kind create cluster --name spring-k8s --wait 5m
在那个程度上,我认为如果我这样做:
deploy:
kubeContext: kind-spring-k8s
helm:
...
事情会奏效,但事实并非如此。
如果我从头开始一切并运行:
skaffold deploy --file-output=images.json -vdebug
我确实看到了:
Tags used in deployment:
- zero-x/spring-cloud-kubernetes/config-map-it -> zero-x/spring-cloud-kubernetes/config-map-it:78da248b669d2fafacbd144cf22d7251dfde57c664c70a5fd7d53793d9d5efd7
DEBU[0000] Local images can't be referenced by digest.
They are tagged and referenced by a unique, local only, tag instead.
See https://skaffold.dev/docs/pipeline-stages/taggers/#how-tagging-works
或者以后:
helm --kube-context kind-spring-k8s dep build src/main/helm
所以这是相当混乱的。我还缺少什么?