kubernetes/kops · error

Error creating endpoint: %v

Error message

Error creating endpoint: %v

What it means

After passing validations, handleCreateDiscoveryEndpoint calls Store.UpsertDiscoveryEndpoint to persist the object. A failure there is returned as 500 'Error creating endpoint: <underlying store error>'. The request itself was valid; persistence failed.

Source

Thrown at discovery/pkg/discovery/server.go:173

	if err := json.NewDecoder(r.Body).Decode(&input); err != nil {
		http.Error(w, "Invalid request body", http.StatusBadRequest)
		return
	}

	// Validation: ensure the name matches the clientID from the cert
	if input.ObjectMeta.Name != "" && input.ObjectMeta.Name != userInfo.ClientID {
		http.Error(w, fmt.Sprintf("Forbidden: cannot register node name '%s' with client cert '%s'", input.ObjectMeta.Name, userInfo.ClientID), http.StatusForbidden)
		return
	}

	// Validation: ensure the namespace in body matches the URL
	if input.ObjectMeta.Namespace != ns {
		http.Error(w, "Forbidden: namespace does not match", http.StatusForbidden)
		return
	}

	if err := s.Store.UpsertDiscoveryEndpoint(r.Context(), universeID, &input); err != nil {
		http.Error(w, fmt.Sprintf("Error creating endpoint: %v", err), http.StatusInternalServerError)
		return
	}

	// Return the created object
	s.writeJSON(w, http.StatusCreated, input)
}

func (s *Server) handleApplyDiscoveryEndpoint(w http.ResponseWriter, r *http.Request, userInfo *UserInfo) {
	ctx := r.Context()
	log := klog.FromContext(ctx)

	universeID := r.PathValue("universe")
	ns := r.PathValue("namespace")
	name := r.PathValue("name")

	var input api.DiscoveryEndpoint
	if err := json.NewDecoder(r.Body).Decode(&input); err != nil {
		log.Info("invalid request body", "error", err)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check server logs/response body for the underlying store error.
  2. Verify the store backend is writable and healthy (connectivity, disk, credentials).
  3. Retry the POST after backend recovery (clients should implement backoff).
  4. Check for store-side conflicts/quotas if errors persist.
Defensive patterns

Strategy: retry

Try / catch

resp, err := client.Post(url, "application/json", body)
if err == nil && resp.StatusCode == http.StatusInternalServerError {
    time.Sleep(backoff)
    return retry()
}

Prevention

When it happens

Trigger: POST create where the store backend errors on write: backend unreachable, read-only storage, quota/capacity exceeded, conflict from concurrent writes, or permission denied for the server's store credentials.

Common situations: Database disk full or read-only replica; store outage during node registration; credential rotation breaking server's write access; serialization conflicts under heavy concurrent registration.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/cf9912eb5e4deee1. Report an issue: GitHub.