0

我正在尝试将入口添加到我的 Kubernetes 文档中。我能够添加 ingress.yaml 文件,并且有大量关于 ingress.yaml 的文档,但我使用 skaffold.yaml 来处理 Kubernetes 部署的细节。而且我找不到任何有关为入口创建 skaffold 文件的文档。(仅使用 googleCloudBuild、buildpacks 和 minikube)我遇到的所有文档都是针对 NGINX 的。

我的项目如下所示:

kubernetes-manifests:
--- frontend_service.deployment.yaml
--- frontend_service.service.yaml 
--- ingress.yaml
--- login_service.deployment.yaml
--- login_service.service.yaml
--- recipes_service.deployment.yaml
--- recipes_service.service.yaml

我当前的 skaffold 文件如下:

apiVersion: skaffold/v2beta4
kind: Config
build:
  tagPolicy:
    sha256: {}
  # defines where to find the code at build time and where to push the resulting image
  artifacts:
  - image: frontend-service
    context: src/frontend
  - image: login-service
    context: src/login
  - image: recipes-service
    context: src/recipes
# defines the Kubernetes manifests to deploy on each run
deploy:
  kubectl:
    manifests:
    - ./kubernetes-manifests/*.service.yaml
    - ./kubernetes-manifests/*.deployment.yaml
profiles:
# use the cloudbuild profile to build images using Google Cloud Build
- name: cloudbuild
  build:
    googleCloudBuild: {}
- name: buildpacks
  build:
    artifacts:
    - image: frontend-service
      context: src/frontend
      buildpack:
        builder: "gcr.io/buildpacks/builder:v1"
    - image: login-service
      context: src/login
      buildpack:
        builder: "gcr.io/buildpacks/builder:v1"
    - image: recipes-service
      context: src/recipes
      buildpack:
        builder: "gcr.io/buildpacks/builder:v1"

这个当前的 skaffold 文件没有部署在入口架构中,它使用后端和前端层。

4

1 回答 1

1

入口定义只是 Kubernetes 资源,因此您只需将您的添加ingress.yaml到要部署的清单中:

deploy:
  kubectl:
    manifests:
    - ./kubernetes-manifests/ingress.yaml
    - ./kubernetes-manifests/*.service.yaml
    - ./kubernetes-manifests/*.deployment.yaml
于 2020-11-18T18:37:02.980 回答