GoogleContainerTools/skaffold

Support KEP 1755 to allow artifact with different registry hostnames

開放

#3,461 建立於 2019年12月30日

 (10 則留言) (4 個反應) (1 位負責人)Go (1,416 個分叉)batch import
area/registryhelp wantedkind/bugpriority/p3

倉庫指標

星標
 (12,822 顆星)
PR 合併指標
 (平均合併 3天 6小時) (30 天內合併 16 個 PR)

描述

Expected behavior

I am building a container image using Maven, Jib, and I am using MicroK8S / Multipass as my local testing environment.

I would expect logs to appear when running skaffold dev --tail --port-forward.

Actual behavior

This is not the case because I have to use different hostnames for the registry, so Skaffold does not detect the dependency between an artifact to build and its usage in a Kubernetes resource file.

Information

  • Skaffold version: 1.1.0
  • Operating system: macOS Catalina
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1
kind: Config
metadata:
  name: rain-and-umbrella
build:
  artifacts:
    - image: microk8s:32000/rain-service
      jib: {}
      context: rain-service
    - image: microk8s:32000/do-i-need-my-umbrella-service
      jib: {}
      context: do-i-need-my-umbrella-service
  insecureRegistries:
    - microk8s:32000
deploy:
  kubectl:
    manifests:
    - "**/k8s/*.yaml"

The issue appears because the MicroK8s registry needs to be accessed from localhost from inside the cluster, as shown in this resources definition:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: rain-service
  name: rain-service
spec:
  selector:
    matchLabels:
      app: rain-service
  template:
    metadata:
      labels:
        app: rain-service
    spec:
      containers:
        - image: localhost:32000/rain-service
          name: rain-service
          livenessProbe:
            httpGet:
              path: /health
              port: 8080
            initialDelaySeconds: 3
            periodSeconds: 5
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: rain-service
  name: rain-service
spec:
  ports:
    - protocol: TCP
      port: 8080
  selector:
    app: rain-service
  type: LoadBalancer

We can see the following warnings in Skaffold logs:

WARN[0007] image [microk8s:32000/do-i-need-my-umbrella-service] is not used by the deployment
WARN[0007] image [microk8s:32000/rain-service] is not used by the deployment

貢獻者指南