restkubernetesctl

kubectl output different than remote API


I am using kubernetes for container orchestration,I dont get any output while running kubectl get rc on the master node while I get a list of replication controllers when using their REST API

curl -X GET masterurl/api/v1/replicationcontrollers.

What am I missing


Solution

  • By default, kubectl only shows resources that are in the default namespace, whereas that REST endpoint will return replication controllers from all namespaces.

    To get the same output from kubectl, run it with the --all-namespaces flag, as in kubectl get rc --all-namespaces.

    If you only want kubectl to return resources from a particular namespace foo that isn't default, you can use --namespace=foo.