Skaffold: require on a k8 service with no artifact

Created on 5 Dec 2020  路  2Comments  路  Source: GoogleContainerTools/skaffold

I have an artifact several services with no artifacts and simply have k8s definitions.
The services are things such as postgres and mongodb. Naturally I need these to be up and running prior to my applications but right now I have no way to define this since the postgres and mongodb don't have an artifact.

Is there a way to specify dependency requirement with no artifacts and based on a k8 service name like can be done using docker-compose?

  • Skaffold version: version: 1.17.1
  • Operating system: Windows 10
apiVersion: skaffold/v2beta10
kind: Config
build:
  local:
    push: false
  artifacts:
    - image: nx2/my-server
      context: ./src/server
      docker:
        dockerfile: Dockerfile
      sync:
        infer:
        - '**/*.py'  
deploy:
  kubectl:
    manifests:
      - k8/apps/my-server*
      - k8/services/postres*

kinquestion

Most helpful comment

Note that Skaffold is happy to deploy arbitrary workload objects as long as there's a single artifact. You can use an initContainer to delay your app container from starting, for example:

      initContainers:
      - name: init-db-ready
        image: mongo:4
        command: ['/bin/sh', '-c']
        args:
          - echo "Waiting for mongodb at python-guestbook-mongodb:27017 to go live before the BE..."; 
          - until (mongo --host python-guestbook-mongodb:27017 >/dev/null) do echo "Waiting for connection for 2 sec."; sleep 2; done

All 2 comments

Unfortunately none of the supported deployers in skaffold currently provide manifest ordering. You might try the kpt deployer, AFAIK it does some common sense ordering and also has a custom ordering feature in the works (https://github.com/GoogleContainerTools/kpt/issues/756)

Note that Skaffold is happy to deploy arbitrary workload objects as long as there's a single artifact. You can use an initContainer to delay your app container from starting, for example:

      initContainers:
      - name: init-db-ready
        image: mongo:4
        command: ['/bin/sh', '-c']
        args:
          - echo "Waiting for mongodb at python-guestbook-mongodb:27017 to go live before the BE..."; 
          - until (mongo --host python-guestbook-mongodb:27017 >/dev/null) do echo "Waiting for connection for 2 sec."; sleep 2; done
Was this page helpful?
0 / 5 - 0 ratings

Related issues

nathkn picture nathkn  路  3Comments

gbird3 picture gbird3  路  3Comments

nathanph picture nathanph  路  3Comments

garvincasimir picture garvincasimir  路  4Comments

r2d4 picture r2d4  路  3Comments