启动代理:

  1. $ kubectl proxy
  2. Starting to serve on 127.0.0.1:8001

访问 http://127.0.0.1:8001/ ,查看支持的API:

  1. {
  2. "paths": [
  3. "/api",
  4. "/api/v1",
  5. "/apis",
  6. "/apis/",
  7. "/apis/admissionregistration.k8s.io",
  8. "/apis/admissionregistration.k8s.io/v1",
  9. "/apis/admissionregistration.k8s.io/v1beta1",
  10. "/apis/apiextensions.k8s.io",
  11. "/apis/apiextensions.k8s.io/v1",
  12. "/apis/apiextensions.k8s.io/v1beta1",
  13. "/apis/apiregistration.k8s.io",
  14. "/apis/apiregistration.k8s.io/v1",
  15. "/apis/apiregistration.k8s.io/v1beta1",
  16. "/apis/apps",
  17. "/apis/apps/v1",
  18. "/apis/authentication.k8s.io",
  19. "/apis/authentication.k8s.io/v1",
  20. "/apis/authentication.k8s.io/v1beta1",
  21. "/apis/authorization.k8s.io",
  22. "/apis/authorization.k8s.io/v1",
  23. "/apis/authorization.k8s.io/v1beta1",
  24. "/apis/autoscaling",
  25. "/apis/autoscaling/v1",
  26. "/apis/autoscaling/v2beta1",
  27. "/apis/autoscaling/v2beta2",
  28. "/apis/batch",
  29. "/apis/batch/v1",
  30. "/apis/batch/v1beta1",
  31. "/apis/certificates.k8s.io",
  32. "/apis/certificates.k8s.io/v1beta1",
  33. "/apis/coordination.k8s.io",
  34. "/apis/coordination.k8s.io/v1",
  35. "/apis/coordination.k8s.io/v1beta1",
  36. "/apis/discovery.k8s.io",
  37. "/apis/discovery.k8s.io/v1beta1",
  38. "/apis/events.k8s.io",
  39. "/apis/events.k8s.io/v1beta1",
  40. "/apis/extensions",
  41. "/apis/extensions/v1beta1",
  42. "/apis/networking.k8s.io",
  43. "/apis/networking.k8s.io/v1",
  44. "/apis/networking.k8s.io/v1beta1",
  45. "/apis/node.k8s.io",
  46. "/apis/node.k8s.io/v1beta1",
  47. "/apis/policy",
  48. "/apis/policy/v1beta1",
  49. "/apis/rbac.authorization.k8s.io",
  50. "/apis/rbac.authorization.k8s.io/v1",
  51. "/apis/rbac.authorization.k8s.io/v1beta1",
  52. "/apis/scheduling.k8s.io",
  53. "/apis/scheduling.k8s.io/v1",
  54. "/apis/scheduling.k8s.io/v1beta1",
  55. "/apis/storage.k8s.io",
  56. "/apis/storage.k8s.io/v1",
  57. "/apis/storage.k8s.io/v1beta1",
  58. "/healthz",
  59. "/healthz/autoregister-completion",
  60. "/healthz/etcd",
  61. "/healthz/log",
  62. "/healthz/ping",
  63. "/healthz/poststarthook/apiservice-openapi-controller",
  64. "/healthz/poststarthook/apiservice-registration-controller",
  65. "/healthz/poststarthook/apiservice-status-available-controller",
  66. "/healthz/poststarthook/bootstrap-controller",
  67. "/healthz/poststarthook/crd-informer-synced",
  68. "/healthz/poststarthook/generic-apiserver-start-informers",
  69. "/healthz/poststarthook/kube-apiserver-autoregistration",
  70. "/healthz/poststarthook/rbac/bootstrap-roles",
  71. "/healthz/poststarthook/scheduling/bootstrap-system-priority-classes",
  72. "/healthz/poststarthook/start-apiextensions-controllers",
  73. "/healthz/poststarthook/start-apiextensions-informers",
  74. "/healthz/poststarthook/start-cluster-authentication-info-controller",
  75. "/healthz/poststarthook/start-kube-aggregator-informers",
  76. "/healthz/poststarthook/start-kube-apiserver-admission-initializer",
  77. "/livez",
  78. "/livez/autoregister-completion",
  79. "/livez/etcd",
  80. "/livez/log",
  81. "/livez/ping",
  82. "/livez/poststarthook/apiservice-openapi-controller",
  83. "/livez/poststarthook/apiservice-registration-controller",
  84. "/livez/poststarthook/apiservice-status-available-controller",
  85. "/livez/poststarthook/bootstrap-controller",
  86. "/livez/poststarthook/crd-informer-synced",
  87. "/livez/poststarthook/generic-apiserver-start-informers",
  88. "/livez/poststarthook/kube-apiserver-autoregistration",
  89. "/livez/poststarthook/rbac/bootstrap-roles",
  90. "/livez/poststarthook/scheduling/bootstrap-system-priority-classes",
  91. "/livez/poststarthook/start-apiextensions-controllers",
  92. "/livez/poststarthook/start-apiextensions-informers",
  93. "/livez/poststarthook/start-cluster-authentication-info-controller",
  94. "/livez/poststarthook/start-kube-aggregator-informers",
  95. "/livez/poststarthook/start-kube-apiserver-admission-initializer",
  96. "/logs",
  97. "/metrics",
  98. "/openapi/v2",
  99. "/readyz",
  100. "/readyz/autoregister-completion",
  101. "/readyz/etcd",
  102. "/readyz/informer-sync",
  103. "/readyz/log",
  104. "/readyz/ping",
  105. "/readyz/poststarthook/apiservice-openapi-controller",
  106. "/readyz/poststarthook/apiservice-registration-controller",
  107. "/readyz/poststarthook/apiservice-status-available-controller",
  108. "/readyz/poststarthook/bootstrap-controller",
  109. "/readyz/poststarthook/crd-informer-synced",
  110. "/readyz/poststarthook/generic-apiserver-start-informers",
  111. "/readyz/poststarthook/kube-apiserver-autoregistration",
  112. "/readyz/poststarthook/rbac/bootstrap-roles",
  113. "/readyz/poststarthook/scheduling/bootstrap-system-priority-classes",
  114. "/readyz/poststarthook/start-apiextensions-controllers",
  115. "/readyz/poststarthook/start-apiextensions-informers",
  116. "/readyz/poststarthook/start-cluster-authentication-info-controller",
  117. "/readyz/poststarthook/start-kube-aggregator-informers",
  118. "/readyz/poststarthook/start-kube-apiserver-admission-initializer",
  119. "/readyz/shutdown",
  120. "/version"
  121. ]
  122. }

访问 http://127.0.0.1:8001/ui

  1. {
  2. "paths": [
  3. "/apis",
  4. "/apis/",
  5. "/apis/apiextensions.k8s.io",
  6. "/apis/apiextensions.k8s.io/v1",
  7. "/apis/apiextensions.k8s.io/v1beta1",
  8. "/healthz",
  9. "/healthz/etcd",
  10. "/healthz/log",
  11. "/healthz/ping",
  12. "/healthz/poststarthook/crd-informer-synced",
  13. "/healthz/poststarthook/generic-apiserver-start-informers",
  14. "/healthz/poststarthook/start-apiextensions-controllers",
  15. "/healthz/poststarthook/start-apiextensions-informers",
  16. "/livez",
  17. "/livez/etcd",
  18. "/livez/log",
  19. "/livez/ping",
  20. "/livez/poststarthook/crd-informer-synced",
  21. "/livez/poststarthook/generic-apiserver-start-informers",
  22. "/livez/poststarthook/start-apiextensions-controllers",
  23. "/livez/poststarthook/start-apiextensions-informers",
  24. "/metrics",
  25. "/openapi/v2",
  26. "/readyz",
  27. "/readyz/etcd",
  28. "/readyz/informer-sync",
  29. "/readyz/log",
  30. "/readyz/ping",
  31. "/readyz/poststarthook/crd-informer-synced",
  32. "/readyz/poststarthook/generic-apiserver-start-informers",
  33. "/readyz/poststarthook/start-apiextensions-controllers",
  34. "/readyz/poststarthook/start-apiextensions-informers",
  35. "/readyz/shutdown",
  36. "/version"
  37. ]
  38. }

访问资源

访问命名空间:
http://localhost:8001/api/v1/namespaces
http://localhost:8001/api/v1/namespaces/jenkins

访问Pods:
http://localhost:8001/api/v1/namespaces/jenkins/pods
http://localhost:8001/api/v1/namespaces/jenkins/pods/jenkins-69c5dcf7dc-ctxd6

访问服务:
http://localhost:8001/api/v1/namespaces/jenkins/services/
http://localhost:8001/api/v1/namespaces/jenkins/services/jenkins

参考资料