Col*_*tel 10 kubernetes kubernetes-apiserver
How do I determine which apiGroup
any given resource belongs in?
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
namespace: default
name: thing
rules:
- apiGroups: ["<wtf goes here>"]
resources: ["deployments"]
verbs: ["get", "list"]
resourceNames: []
Run Code Online (Sandbox Code Playgroud)
Mar*_*ark 15
要获取 Kubernetes 集群支持的 API 资源:
kubectl api-resources -o wide
example:
NAME SHORTNAMES APIGROUP NAMESPACED KIND VERBS
deployments deploy apps true Deployment [create delete deletecollection get list patch update watch]
deployments deploy extensions true Deployment [create delete deletecollection get list patch update watch]
Run Code Online (Sandbox Code Playgroud)
要获取 Kubernetes 集群支持的 API 版本:
kubectl api-versions
Run Code Online (Sandbox Code Playgroud)
您可以验证 fe 部署:
kubectl explain deploy
KIND: Deployment
VERSION: extensions/v1beta1
DESCRIPTION:
DEPRECATED - This group version of Deployment is deprecated by
apps/v1beta2/Deployment.
Run Code Online (Sandbox Code Playgroud)
此外,您可以使用 api-version 进行调查:
kubectl explain deploy --api-version apps/v1
Run Code Online (Sandbox Code Playgroud)
很快你就在你的 apiGroups 中指定了一个:
apiGroups: ["extensions", "apps"]
Run Code Online (Sandbox Code Playgroud)
您还可以通过 在kube-apiserver 中传递选项来使用(例如测试它是否适用于下一个1.16 版本)为您的集群配置这些设置。--runtime-config
其他资源:
Continued deprecation of extensions/v1beta1, apps/v1beta1, and apps/v1beta2 APIs; these extensions will be retired in 1.16!
在更高的 k8s 版本中,apigroup
已弃用,并且该命令kubectl api-resources -o wide
将apiversion
改为显示,它是以下命令的组合apigroup/version
kubectl api-resources -o wide
提供系统支持的 API 资源。
[suresh.vishnoi@xxx1309 ~]$ kubectl api-resources -o wide
NAME SHORTNAMES APIGROUP NAMESPACED KIND VERBS
bindings true Binding [create]
componentstatuses cs false ComponentStatus [get list]
configmaps cm true ConfigMap [create delete deletecollection get list patch update watch]
endpoints ep true Endpoints [create delete deletecollection get list patch update watch]
events ev true Event [create delete deletecollection get list patch update watch]
controllerrevisions apps true ControllerRevision [create delete deletecollection get list patch update watch]
daemonsets ds apps true DaemonSet [create delete deletecollection get list patch update watch]
deployments deploy apps true Deployment [create delete deletecollection get list patch update watch]
replicasets rs apps true ReplicaSet [create delete deletecollection get list patch update watch]
Run Code Online (Sandbox Code Playgroud)
kubectl api-resources -o wide | grep -i deployment
将提供相关信息
apps是部署资源的 apiGroup
DaemonSet、Deployment、StatefulSet 和 ReplicaSet:在 v1.16 中将不再从 extensions/v1beta1、apps/v1beta1 或 apps/v1beta2 提供服务。迁移到自 v1.9 起可用的 apps/v1 API。可以通过 apps/v1 API 检索/更新现有的持久数据。/api-deprecations-in-1-16
归档时间: |
|
查看次数: |
7350 次 |
最近记录: |