GoogleContainerTools/skaffold

Support KEP 1755 to allow artifact with different registry hostnames

Open

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

在 GitHub 查看
 (10 留言) (4 反應) (1 負責人)Go (12,822 star) (1,416 fork)batch import
area/registryhelp wantedkind/bugpriority/p3

描述

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

貢獻者指南