GoogleContainerTools/skaffold · error
invalid local-registry-hosting ConfigMap
Error message
invalid local-registry-hosting ConfigMap
What it means
Skaffold's discoverLocalRegistry reads the 'localRegistryHosting.v1' key from the 'local-registry-hosting' ConfigMap in the kube-system namespace to detect a locally hosted registry. If the ConfigMap exists but lacks that data key, it cannot extract registry hosting info and throws this error. It signals a malformed or non-standard ConfigMap rather than a missing one.
Source
Thrown at pkg/skaffold/config/util.go:389
func discoverLocalRegistry(ctx context.Context, kubeContext string) (*string, error) {
clientset, err := kubeclient.Client(kubeContext)
if err != nil {
return nil, err
}
configMap, err := clientset.CoreV1().ConfigMaps("kube-public").Get(ctx, "local-registry-hosting", api_v1.GetOptions{})
statusErr := &api_errors.StatusError{}
switch {
case errors.As(err, &statusErr) && statusErr.Status().Code == http.StatusNotFound:
return nil, nil
case err != nil:
return nil, err
}
data, ok := configMap.Data["localRegistryHosting.v1"]
if !ok {
return nil, errors.New("invalid local-registry-hosting ConfigMap")
}
dst := struct {
Host *string `yaml:"host"`
}{}
if err := yaml.Unmarshal([]byte(data), &dst); err != nil {
return nil, errors.New("invalid local-registry-hosting ConfigMap")
}
return dst.Host, nil
}
func IsUpdateCheckEnabled(configfile string) bool {
cfg, err := GetConfigForCurrentKubectx(configfile)
if err != nil {
return true
}View on GitHub (pinned to a1189de023)
Solutions
- Inspect the ConfigMap: kubectl -n kube-system get configmap local-registry-hosting -o yaml
- Add or fix the data key so it is exactly 'localRegistryHosting.v1' containing a 'host:' field (per KEPS-1755 convention)
- If the registry is no longer hosted, delete the ConfigMap so Skaffold can fall back to the default behavior
- Verify with a YAML parser that data['localRegistryHosting.v1'] parses as YAML with a host field
Example fix
// before
apiVersion: v1
kind: ConfigMap
metadata:
name: local-registry-hosting
namespace: kube-system
data:
registry: myregistry:5000
// after
data:
localRegistryHosting.v1: |
host: localhost:5000
help: https://kind.sigs.k8s.io/docs/user/local-registry/ Defensive patterns
Strategy: validation
Validate before calling
cm, _ := clientset.CoreV1().ConfigMaps("kube-system").Get(ctx, "local-registry-hosting", metav1.GetOptions{})
if cm.Data == nil || cm.Data["localRegistryHosting.v1"] == "" {
// treat as no local registry; fix the ConfigMap before running skaffold
} Type guard
func hasLocalRegistryHosting(cm *corev1.ConfigMap) bool {
v, ok := cm.Data["localRegistryHosting.v1"]
return ok && strings.TrimSpace(v) != ""
} Prevention
- Keep the ConfigMap key exactly 'localRegistryHosting.v1'
- Validate the ConfigMap YAML against the KEP-1755 schema after edits
- Use the upstream kind/local-registry-hosting manifest instead of hand-writing one
When it happens
Trigger: Running skaffold against a cluster where a ConfigMap named local-registry-hosting exists in kube-system but has no 'localRegistryHosting.v1' entry in its data field (e.g. created by a non-conforming tool or edited manually).
Common situations: Clusters set up with a partial or hand-written local-registry-hosting ConfigMap; tools writing the ConfigMap with a wrong key name (e.g. 'localRegistryHosting' or 'v1' instead of 'localRegistryHosting.v1'); empty data map after config removal.
Related errors
- STATUSCHECK_IMAGE_PULL_ERR
- error decoding parsed yaml: %s
- parsing manifests file into manifest list object: %w
- marshalling yaml: %w
- error converting %s to map[string]interface{}
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/85c265676bdf912c.
Report an issue: GitHub.