I've created a demo git repo with examples I'm struggling with.
I'm using skaffold dev -p local --port-forward
command to get generated k8s configuration + to run service in minikube.
apiVersion: skaffold/v4beta1
kind: Config
profiles:
- name: local
build:
artifacts:
- context: code/
docker:
dockerfile: Dockerfile
image: demo
manifests:
kustomize:
paths:
- code/kustomize #here it works
But if I change skaffold to use config dependencies like this
apiVersion: skaffold/v4beta1
kind: Config
metadata:
name: core
requires: #this don't work
- configs:
- add
path: skaffold/demo.yaml
The skaffold does not generate service in minikube + there is no port forwarding. The command skaffold render
do generate the manifests.
I've isolated the question so anyone can reproduce this.
Am I missing something? Why would skaffold not generate manifest when using config dependencies?
EDIT:
skaffold version == v2.9.0
In your first scenario, where you only have one skaffold.yaml
config file, Skaffold is able to inject a default deployer, so running a command like skaffold dev
will work as expected; it will deploy your resources.
In your second scenario, using config dependencies, it will not be able to inject a default deployer, so running skaffold dev
won't deploy anything. This behavior explains why you can get the rendered manifests but can not get anything deployed in your cluster.
To be able to make this work you'll need to configure a deployer in your skaffold/demo.yaml
file, it will look something like this:
apiVersion: skaffold/v4beta1
kind: Config
metadata:
name: demo
profiles:
- name: local
build:
artifacts:
- context: code/
docker:
dockerfile: Dockerfile
image: demo
manifests:
kustomize:
paths:
- code/kustomize
deploy:
kubectl: {} # <- explicitly defining a kubectl deployer
And your root skaffold.yaml
file will look like:
apiVersion: skaffold/v4beta1
kind: Config
metadata:
name: core
requires:
- configs:
- demo
path: skaffold/demo.yaml
Hope this helps!