As far as I can tell from the docs, there's not a way to specify a template that Skaffold can use when creating the Kaniko pod. Am I missing something? For example, in a Tekton pipeline, I use Skaffold as a container (task step) which then itself spawns a Kaniko pod. I want to mount a volume into the Kaniko pod so I can capture some bytes for use in the original task pod. It looks like you can mount a volume no problem, but the Kaniko volume spec in the skaffold.yaml is also not well documented outside of the secret mount. Any help or an example would be great, Thanks.
@tejal29 - is this something you can assistance on?
@adjavaherian currently it is not possible to template kaniko pod spec within skaffold.yaml.
Skaffold interfaces with many tools and we have thought in past about
buildArgs, args in the spec.Re: Volumemounts.
The volumeMounts field in Kaniko volume spec is same is k8 volume spec.
e.g.
volumeMounts: []v1.VolumeMount{
{
Name: "cm-volume-1",
ReadOnly: true,
MountPath: "/cm-test-mount-path",
SubPath: "/subpath",
},
{
Name: "secret-volume-1",
ReadOnly: true,
MountPath: "/secret-test-mount-path",
SubPath: "/subpath",
},
},
I'm interested in something like this as well, but get schema errors in Skaffold v1.8.0. I would like to use gcr.io/kaniko-project/warmer:latest as shown in this example to create a volume with the cached base image I'll be building on top of. That could be a step outside of Skaffold, but once created I would like to mount that volume and use the --cache-dir Kaniko flag to use it at runtime.
Going off the volumes and volumeMounts fields mentioned in the docs, I tried the following:
apiVersion: skaffold/v2beta2
kind: Config
metadata:
name: my-app
build:
artifacts:
- image: repo/my-app
kaniko:
cache:
repo: repo/my-app-cache
volumeMounts:
- name: kaniko-cache
mountPath: /cache
cluster:
dockerConfig:
path: ./config.json
volumes:
- name: kaniko-cache
persistentVolumeClaim:
claimName: kaniko-cache-claim
I get a parsing error on both though:
> skaffold build
FATA[0000] creating runner: parsing skaffold config: unable to parse config: yaml: unmarshal errors:
line 9: field mountPath not found in type v1.VolumeMount
line 16: field persistentVolumeClaim not found in type v1.Volume
Getting the exact same error
parsing skaffold config: unable to parse config: yaml: unmarshal errors:
line 11: field mountPath not found in type v1.VolumeMount
@frayer and @adjavaherian As @dranes mentioned in #4175 the right way to configure volumeMounts is to use lower case mountpath and readonly
kaniko:
volumeMounts:
- name: data
mountpath: /data
readonly: true
Closing this issue now. Please comment if it does not fix your issue
Most helpful comment
I'm interested in something like this as well, but get schema errors in Skaffold
v1.8.0. I would like to usegcr.io/kaniko-project/warmer:latestas shown in this example to create a volume with the cached base image I'll be building on top of. That could be a step outside of Skaffold, but once created I would like to mount that volume and use the--cache-dirKaniko flag to use it at runtime.Going off the
volumesandvolumeMountsfields mentioned in the docs, I tried the following:I get a parsing error on both though: