pkaramol
pkaramol

Reputation: 19352

Use local image in the cluster that skaffold is connected to

Assuming I have the following skaffold.yaml

apiVersion: skaffold/v2beta12
kind: Config
metadata:
  name: myapp
build:
  local:
    push: true
  artifacts:
  - image: pkaramol/my-image
    docker:
      dockerfile: Dockerfile
deploy:
  helm:
    releases:
      - name: myapp
        chartPath: charts
  kubectl:
    manifests:
       - ./k8s/*

How can I instruct skaffold to avoid uploading (and then downloading) pkaramol/myimage to dockerhub but rather build it locally and using it directly within the cluster I am connected to?

Upvotes: 1

Views: 1040

Answers (1)

aaron-prindle
aaron-prindle

Reputation: 3307

You can instruct Skaffold to build the image locally by using the local build mode in the build section of the skaffold.yaml file, like this:

apiVersion: skaffold/v2beta12
kind: Config
metadata:
  name: myapp
build:
  local:
    push: false
  artifacts:
  - image: pkaramol/my-image
    docker:
      dockerfile: Dockerfile
deploy:
  helm:
    releases:
      - name: myapp
        chartPath: charts
  kubectl:
    manifests:
       - ./k8s/*

The push parameter should be set to false to prevent Skaffold from uploading the image to a registry. This will tell Skaffold to build the image locally and use it directly in the cluster that you are connected to.

Upvotes: 3

Related Questions