一、查看当前kubernetes支持的版本资源类型

Print the supported API versions on the server, in the form of “group/version”

  1. [root@k8s-5-138 ~]# kubectl api-versions
  2. admissionregistration.k8s.io/v1
  3. admissionregistration.k8s.io/v1beta1
  4. apiextensions.k8s.io/v1
  5. apiextensions.k8s.io/v1beta1
  6. apiregistration.k8s.io/v1
  7. apiregistration.k8s.io/v1beta1
  8. apps/v1
  9. authentication.k8s.io/v1
  10. authentication.k8s.io/v1beta1
  11. authorization.k8s.io/v1
  12. authorization.k8s.io/v1beta1
  13. autoscaling/v1
  14. autoscaling/v2beta1
  15. autoscaling/v2beta2
  16. batch/v1
  17. batch/v1beta1
  18. certificates.k8s.io/v1beta1
  19. coordination.k8s.io/v1
  20. coordination.k8s.io/v1beta1
  21. discovery.k8s.io/v1beta1
  22. events.k8s.io/v1beta1
  23. extensions/v1beta1
  24. networking.k8s.io/v1
  25. networking.k8s.io/v1beta1
  26. node.k8s.io/v1beta1
  27. policy/v1beta1
  28. rbac.authorization.k8s.io/v1
  29. rbac.authorization.k8s.io/v1beta1
  30. scheduling.k8s.io/v1
  31. scheduling.k8s.io/v1beta1
  32. storage.k8s.io/v1
  33. storage.k8s.io/v1beta1
  34. v1

二、查看当前kubernetes支持的资源类型
api-resources Print the supported API resources on the server

  1. [root@k8s-5-138 pod_template]# kubectl api-resources
  2. NAME SHORTNAMES APIGROUP NAMESPACED KIND
  3. bindings true Binding
  4. componentstatuses cs false ComponentStatus
  5. configmaps cm true ConfigMap
  6. endpoints ep true Endpoints
  7. events ev true Event
  8. limitranges limits true LimitRange
  9. namespaces ns false Namespace
  10. nodes no false Node
  11. persistentvolumeclaims pvc true PersistentVolumeClaim
  12. persistentvolumes pv false PersistentVolume
  13. pods po true Pod
  14. podtemplates true PodTemplate
  15. replicationcontrollers rc true ReplicationController
  16. resourcequotas quota true ResourceQuota
  17. secrets true Secret
  18. serviceaccounts sa true ServiceAccount
  19. services svc true Service
  20. mutatingwebhookconfigurations admissionregistration.k8s.io false MutatingWebhookConfiguration
  21. validatingwebhookconfigurations admissionregistration.k8s.io false ValidatingWebhookConfiguration
  22. customresourcedefinitions crd,crds apiextensions.k8s.io false CustomResourceDefinition
  23. apiservices apiregistration.k8s.io false APIService
  24. controllerrevisions apps true ControllerRevision
  25. daemonsets ds apps true DaemonSet
  26. deployments deploy apps true Deployment
  27. replicasets rs apps true ReplicaSet
  28. statefulsets sts apps true StatefulSet
  29. tokenreviews authentication.k8s.io false TokenReview
  30. localsubjectaccessreviews authorization.k8s.io true LocalSubjectAccessReview
  31. selfsubjectaccessreviews authorization.k8s.io false SelfSubjectAccessReview
  32. selfsubjectrulesreviews authorization.k8s.io false SelfSubjectRulesReview
  33. subjectaccessreviews authorization.k8s.io false SubjectAccessReview
  34. horizontalpodautoscalers hpa autoscaling true HorizontalPodAutoscaler
  35. cronjobs cj batch true CronJob
  36. jobs batch true Job
  37. certificatesigningrequests csr certificates.k8s.io false CertificateSigningRequest
  38. leases coordination.k8s.io true Lease
  39. endpointslices discovery.k8s.io true EndpointSlice
  40. events ev events.k8s.io true Event
  41. ingresses ing extensions true Ingress
  42. ingressclasses networking.k8s.io false IngressClass
  43. ingresses ing networking.k8s.io true Ingress
  44. networkpolicies netpol networking.k8s.io true NetworkPolicy
  45. runtimeclasses node.k8s.io false RuntimeClass
  46. poddisruptionbudgets pdb policy true PodDisruptionBudget
  47. podsecuritypolicies psp policy false PodSecurityPolicy
  48. clusterrolebindings rbac.authorization.k8s.io false ClusterRoleBinding
  49. clusterroles rbac.authorization.k8s.io false ClusterRole
  50. rolebindings rbac.authorization.k8s.io true RoleBinding
  51. roles rbac.authorization.k8s.io true Role
  52. priorityclasses pc scheduling.k8s.io false PriorityClass
  53. csidrivers storage.k8s.io false CSIDriver
  54. csinodes storage.k8s.io false CSINode
  55. storageclasses sc storage.k8s.io false StorageClass
  56. volumeattachments storage.k8s.io false VolumeAttachment

三、资源类型的解释

  1. [root@k8s-5-138 pod_template]# kubectl explain deployment
  2. KIND: Deployment
  3. VERSION: apps/v1
  4. DESCRIPTION:
  5. Deployment enables declarative updates for Pods and ReplicaSets.
  6. FIELDS:
  7. apiVersion <string>
  8. APIVersion defines the versioned schema of this representation of an
  9. object. Servers should convert recognized schemas to the latest internal
  10. value, and may reject unrecognized values. More info:
  11. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
  12. kind <string>
  13. Kind is a string value representing the REST resource this object
  14. represents. Servers may infer this from the endpoint the client submits
  15. requests to. Cannot be updated. In CamelCase. More info:
  16. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
  17. metadata <Object>
  18. Standard object metadata.
  19. spec <Object>
  20. Specification of the desired behavior of the Deployment.
  21. status <Object>
  22. Most recently observed status of the Deployment.
  23. [root@k8s-5-138 pod_template]# kubectl explain ConfigMap
  24. KIND: ConfigMap
  25. VERSION: v1
  26. DESCRIPTION:
  27. ConfigMap holds configuration data for pods to consume.
  28. FIELDS:
  29. apiVersion <string>
  30. APIVersion defines the versioned schema of this representation of an
  31. object. Servers should convert recognized schemas to the latest internal
  32. value, and may reject unrecognized values. More info:
  33. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
  34. binaryData <map[string]string>
  35. BinaryData contains the binary data. Each key must consist of alphanumeric
  36. characters, '-', '_' or '.'. BinaryData can contain byte sequences that are
  37. not in the UTF-8 range. The keys stored in BinaryData must not overlap with
  38. the ones in the Data field, this is enforced during validation process.
  39. Using this field will require 1.10+ apiserver and kubelet.
  40. data <map[string]string>
  41. Data contains the configuration data. Each key must consist of alphanumeric
  42. characters, '-', '_' or '.'. Values with non-UTF-8 byte sequences must use
  43. the BinaryData field. The keys stored in Data must not overlap with the
  44. keys in the BinaryData field, this is enforced during validation process.
  45. immutable <boolean>
  46. Immutable, if set to true, ensures that data stored in the ConfigMap cannot
  47. be updated (only object metadata can be modified). If not set to true, the
  48. field can be modified at any time. Defaulted to nil. This is an alpha field
  49. enabled by ImmutableEphemeralVolumes feature gate.
  50. kind <string>
  51. Kind is a string value representing the REST resource this object
  52. represents. Servers may infer this from the endpoint the client submits
  53. requests to. Cannot be updated. In CamelCase. More info:
  54. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
  55. metadata <Object>
  56. Standard object's metadata. More info:
  57. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata