Welcome to the Linux Foundation Forum!

Office hours - Jan 16 (LFS258)

Options

Hi,

Today we clarified a question about the service endpoint URL from Chapter 9: Services - page 8: Local Proxy for Development.

This page shows a URL that includes /namespaces/default/ and the learner assumed a behavior similar to the kubectl command should be expected when targeting resources from the default namespace:

URL: http://localhost:8001/api/v1/namespaces/default/services/ghost

vs

Command: kubectl [-n default] get service ghost

The kubectl command implicitly targets a resource from the default namespace if no namespace is explicitly supplied with the -n flag, therefore the learner assumed that the /namespaces/default/ can be omitted from the URL and it would implicitly target a resource from the default namespace.

The behavior is not mirrored. In the URL the /namespaces/default/ is required explicitly, while with kubectl the namespace name can be omitted when targeting a resource from the default namespace (optionally it can be supplied as -n default if desired).

Regards,
-Chris

Categories

Upcoming Training