简体   繁体   English

在 skaffold 连接的集群中使用本地镜像

[英]Use local image in the cluster that skaffold is connected to

Assuming I have the following skaffold.yaml假设我有以下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?我如何指示skaffold避免将pkaramol/myimage上传(然后下载)到 dockerhub,而是在本地构建它并直接在我连接的集群中使用它?

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:您可以使用 skaffold.yaml 文件的build部分中的local构建模式指示 Skaffold 在本地构建映像,如下所示:

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. push参数应设置为false以防止 Skaffold 将图像上传到注册表。 This will tell Skaffold to build the image locally and use it directly in the cluster that you are connected to.这将告诉 Skaffold 在本地构建映像并直接在您连接的集群中使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM