其他分享
首页 > 其他分享> > kubernetes yaml中的apiVersion如何选择?

kubernetes yaml中的apiVersion如何选择?

作者:互联网

再创建不同的资源时,yaml文件中的apiVersion版本不一样,那该如何选择?

kubenetes提供的api和版本信息:

kubectl api-resources -o wide

  -o wide: 列出详细信息

[root@k8s-master1~]#kubectl api-resources
NAME                              SHORTNAMES   APIGROUP                       NAMESPACED   KIND
bindings                                                                      true         Binding
componentstatuses                 cs                                          false        ComponentStatus
configmaps                        cm                                          true         ConfigMap
endpoints                         ep                                          true         Endpoints
events                            ev                                          true         Event
limitranges                       limits                                      true         LimitR
...

获取特定 API 组的 API 资源:

[root@k8s-master1~]#kubectl api-resources --api-group apps
NAME                  SHORTNAMES   APIGROUP   NAMESPACED   KIND
controllerrevisions                apps       true         ControllerRevision
daemonsets            ds           apps       true         DaemonSet
deployments           deploy       apps       true         Deployment
replicasets           rs           apps       true         ReplicaSet
statefulsets          sts          apps       true         StatefulSet

查询k8s支持的所有api:

[root@k8s-master1~]#kubectl api-versions
admissionregistration.k8s.io/v1beta1
apiextensions.k8s.io/v1beta1
apiregistration.k8s.io/v1
apiregistration.k8s.io/v1beta1
apps/v1
apps/v1beta1
apps/v1beta2
authentication.k8s.io/v1
authentication.k8s.io/v1beta1
authorization.k8s.io/v1
authorization.k8s.io/v1beta1
autoscaling/v1
autoscaling/v2beta1
autoscaling/v2beta2
batch/v1
batch/v1beta1
certificates.k8s.io/v1beta1
coordination.k8s.io/v1
coordination.k8s.io/v1beta1
events.k8s.io/v1beta1
extensions/v1beta1
networking.k8s.io/v1
networking.k8s.io/v1beta1
node.k8s.io/v1beta1
policy/v1beta1
rbac.authorization.k8s.io/v1
rbac.authorization.k8s.io/v1beta1
scheduling.k8s.io/v1
scheduling.k8s.io/v1beta1
storage.k8s.io/v1
storage.k8s.io/v1beta1
v1
# 也可以通过获取到指定资源的apiVersion
[root@k8s-master1~]#kubectl explain deployment
KIND:     Deployment
VERSION:  extensions/v1beta1

 

标签:kubernetes,v1,apps,apiVersion,yaml,io,k8s,true,v1beta1
来源: https://www.cnblogs.com/yangxulong912/p/16199110.html