Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies in kubectl deployments? #3321

Open
dirkevertz opened this issue Nov 28, 2019 · 5 comments
Open

Dependencies in kubectl deployments? #3321

dirkevertz opened this issue Nov 28, 2019 · 5 comments
Labels
area/ci-cd area/deploy deploy/kubectl kind/feature-request kind/todo implementation task/epic for the skaffold team priority/p2 May take a couple of releases

Comments

@dirkevertz
Copy link

dirkevertz commented Nov 28, 2019

Is there any possibility to take care of dependencies or to enforce that separate kubectl commands are launched (instead of a single one)? I am facing the issue, that the deployment fails due to an "unable to recognize"-error:

error: unable to recognize "c:\\daten\\projects\\kubernetes\\nodejsSkaffold\\kubernetes-manifests\\4_rate_limiting.yaml": no matches for kind "KongPlugin" in version "configuration.konghq.com/v1"

See log file:
log.txt

This is caused due to the fact that 0_all-in-one-dbless.yaml needs to be deployed first of all (as KongPlugin is defined in this file).

Expected behavior

Enforce seperate execution of kubectl for certain files:

1st step: execute ./kubernetes-manifests/0_all-in-one-dbless.yaml
2nd step: execute
- ./kubernetes-manifests/1_nodejs.deployment.yaml
- ./kubernetes-manifests/2_nodejs.service.deployment.yaml
- ./kubernetes-manifests/3_nodejs.ingress.deployment.yaml
- ./kubernetes-manifests/4_rate_limiting.yaml

Actual behavior

Currently a single kubectl is executed:

kubectl --context docker-desktop create --validate=false --dry-run -oyaml -f c:\daten\projects\kubernetes\nodejsSkaffold\kubernetes-manifests\0_all-in-one-dbless.yaml -f c:\daten\projects\kubernetes\nodejsSkaffold\kubernetes-manifests\1_nodejs.deployment.yaml -f c:\daten\projects\kubernetes\nodejsSkaffold\kubernetes-manifests\2_nodejs.service.deployment.yaml -f c:\daten\projects\kubernetes\nodejsSkaffold\kubernetes-manifests\3_nodejs.ingress.deployment.yaml -f c:\daten\projects\kubernetes\nodejsSkaffold\kubernetes-manifests\4_rate_limiting.yaml

Information

  • Skaffold version: v1.0.1
  • Operating system: Windows 10
  • Contents of skaffold.yaml:

apiVersion: skaffold/v1beta15
kind: Config
build:
tagPolicy:
sha256: {}

defines where to find the code at build time and where to push the resulting image

artifacts:

  • image: nodejs
    context: .
    docker:
    noCache: true

defines the Kubernetes manifests to deploy on each run

deploy:
kubectl:
flags:
apply:
- "--validate=false"
manifests:
# 0_all-in-one-dbless.yaml contents https://raw.githubusercontent.com/Kong/kubernetes-ingress-controller/master/deploy/single/all-in-one-dbless.yaml
- ./kubernetes-manifests/0_all-in-one-dbless.yaml
- ./kubernetes-manifests/1_nodejs.deployment.yaml
- ./kubernetes-manifests/2_nodejs.service.deployment.yaml
- ./kubernetes-manifests/3_nodejs.ingress.deployment.yaml
- ./kubernetes-manifests/4_rate_limiting.yaml

Steps to reproduce the behavior

  1. a clonable repository with the sample skaffold project
  2. skaffold <command>
  3. ...
@tejal29
Copy link
Contributor

tejal29 commented Dec 2, 2019

@dirkevertz We are aware of this issue and the team is working on a plan to preserve 1* (numbering) for kubectl render support.

@tejal29 tejal29 added the priority/p1 High impact feature/bug. label Dec 5, 2019
@nkubala nkubala added this to the Backlog [P0/P1] milestone Sep 1, 2020
@nkubala nkubala removed this from the Backlog [P0/P1] milestone May 11, 2021
@tejal29 tejal29 added area/v3 V3 area/V2 and removed area/v3 V3 labels Jul 1, 2021
@tejal29
Copy link
Contributor

tejal29 commented Jul 1, 2021

/cc @gsquared94 to add example with multiple deployers with CRDs etc. I don't think we still support multiple deployers of same type right?

@tejal29
Copy link
Contributor

tejal29 commented Jul 1, 2021

Subtaks for #5857

@gsquared94
Copy link
Contributor

I would recommend trying out kpt deployer that can handle a lot of these scenarios about the right order of deploys. Here's an example how: https://github.com/GoogleContainerTools/skaffold/tree/master/codelab/02_kpt-deploy

Alternately,

Since you know the exact order that the deploy needs to be applied you can also do:
skaffold.yaml:

apiVersion: skaffold/v2beta18
kind: Config
deploy:
  kubectl: 
     - ./kubernetes-manifests/0_all-in-one-dbless.yaml
---
apiVersion: skaffold/v2beta18
kind: Config
deploy:
  kubectl: 
    - ./kubernetes-manifests/1_nodejs.deployment.yaml
    - ./kubernetes-manifests/2_nodejs.service.deployment.yaml
    - ./kubernetes-manifests/3_nodejs.ingress.deployment.yaml
    - ./kubernetes-manifests/4_rate_limiting.yaml
     

@tejal29 tejal29 added the kind/todo implementation task/epic for the skaffold team label Oct 13, 2021
@nkubala nkubala removed the area/V2 label Nov 15, 2021
@tejal29 tejal29 added priority/p2 May take a couple of releases and removed priority/p1 High impact feature/bug. labels Mar 31, 2022
@mbana
Copy link

mbana commented Oct 11, 2022

I would recommend trying out kpt deployer that can handle a lot of these scenarios about the right order of deploys. Here's an example how: https://github.com/GoogleContainerTools/skaffold/tree/master/codelab/02_kpt-deploy

Alternately,

Since you know the exact order that the deploy needs to be applied you can also do: skaffold.yaml:

apiVersion: skaffold/v2beta18
kind: Config
deploy:
  kubectl: 
     - ./kubernetes-manifests/0_all-in-one-dbless.yaml
---
apiVersion: skaffold/v2beta18
kind: Config
deploy:
  kubectl: 
    - ./kubernetes-manifests/1_nodejs.deployment.yaml
    - ./kubernetes-manifests/2_nodejs.service.deployment.yaml
    - ./kubernetes-manifests/3_nodejs.ingress.deployment.yaml
    - ./kubernetes-manifests/4_rate_limiting.yaml
     

Worked for me. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci-cd area/deploy deploy/kubectl kind/feature-request kind/todo implementation task/epic for the skaffold team priority/p2 May take a couple of releases
Projects
None yet
Development

No branches or pull requests

5 participants