Use an HTTP Proxy to Access the Kubernetes API

    You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. It is recommended to run this tutorial on a cluster with at least two nodes that are not acting as control plane hosts. If you do not already have a cluster, you can create one by using or you can use one of these Kubernetes playgrounds:

    To check the version, enter .

    This command starts a proxy to the Kubernetes API server:

    1. kubectl proxy --port=8080

    When the proxy server is running, you can explore the API using curl, wget, or a browser.

    The output should look similar to this:

    1. {
    2. "kind": "APIVersions",
    3. "versions": [
    4. "v1"
    5. ],
    6. {
    7. "clientCIDR": "0.0.0.0/0",
    8. }
    9. ]
    10. }

    Get a list of pods:

    1. {
    2. "kind": "PodList",
    3. "apiVersion": "v1",
    4. "metadata": {
    5. "resourceVersion": "33074"
    6. },
    7. {
    8. "name": "kubernetes-bootcamp-2321272333-ix8pt",
    9. "generateName": "kubernetes-bootcamp-2321272333-",
    10. "namespace": "default",
    11. "uid": "ba21457c-6b1d-11e6-85f7-1ef9f1dab92b",
    12. "resourceVersion": "33003",
    13. "creationTimestamp": "2016-08-25T23:43:30Z",
    14. "labels": {
    15. "pod-template-hash": "2321272333",
    16. "run": "kubernetes-bootcamp"
    17. },

    Learn more about .