Rest Kubernetes中的自定义资源定义URL是什么
我试图在Kubernetes中找到我的自定义资源定义端点,但找不到Kubernetes如何在Kubernetes API中公开我的自定义资源定义的确切示例。如果我点击自定义服务API,请执行以下操作:Rest Kubernetes中的自定义资源定义URL是什么,rest,kubernetes,kubernetes-custom-resources,Rest,Kubernetes,Kubernetes Custom Resources,我试图在Kubernetes中找到我的自定义资源定义端点,但找不到Kubernetes如何在Kubernetes API中公开我的自定义资源定义的确切示例。如果我点击自定义服务API,请执行以下操作: https://localhost:6443/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions 我得到了回复 "items": [ { "metadata": { "name":
https://localhost:6443/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions
我得到了回复
"items": [
{
"metadata": {
"name": "accounts.stable.ibm.com",
"selfLink": "/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/accounts.stable.ibm.com",
"uid": "eda9d695-d3d4-11e9-900f-025000000001",
"resourceVersion": "167252",
"generation": 1,
"creationTimestamp": "2019-09-10T14:11:48Z",
"deletionTimestamp": "2019-09-12T22:26:20Z",
"finalizers": [
"customresourcecleanup.apiextensions.k8s.io"
]
},
"spec": {
"group": "stable.ibm.com",
"version": "v1",
"names": {
"plural": "accounts",
"singular": "account",
"shortNames": [
"acc"
],
"kind": "Account",
"listKind": "AccountList"
},
"scope": "Namespaced",
"versions": [
{
"name": "v1",
"served": true,
"storage": true
}
],
"conversion": {
"strategy": "None"
}
},
"status": {
"conditions": [
{
"type": "NamesAccepted",
"status": "True",
"lastTransitionTime": "2019-09-10T14:11:48Z",
"reason": "NoConflicts",
"message": "no conflicts found"
},
{
"type": "Established",
"status": "True",
"lastTransitionTime": null,
"reason": "InitialNamesAccepted",
"message": "the initial names have been accepted"
},
{
"type": "Terminating",
"status": "True",
"lastTransitionTime": "2019-09-12T22:26:20Z",
"reason": "InstanceDeletionCheck",
"message": "could not confirm zero CustomResources remaining: timed out waiting for the condition"
}
],
"acceptedNames": {
"plural": "accounts",
"singular": "account",
"shortNames": [
"acc"
],
"kind": "Account",
"listKind": "AccountList"
},
"storedVersions": [
"v1"
]
}
}
]
}
这使我相信我已经正确地创建了自定义资源帐户。有许多例子似乎不太正确,我无法在Kubernetes REST api中找到我的资源。我可以从kubectl使用我的自定义资源,但我需要用RESTful API公开它
https://localhost:6443/apis/stable.example.com/v1/namespaces/default/accounts
返回
404 page not found
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "the server could not find the requested resource",
"reason": "NotFound",
"details": {},
"code": 404
}
其中:
https://localhost:6443/apis/apiextensions.k8s.io/v1beta1/apis/stable.ibm.com/namespaces/default/accounts
返回
404 page not found
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": "the server could not find the requested resource",
"reason": "NotFound",
"details": {},
"code": 404
}
我已经看过了
准确的URL将不胜感激。这是一种相当不错的检索K8s资源的方法,在一些顶级调试级别执行
kubectl get
命令,如注释中提到的@Suresh Vishnoi:
kubectl-get,或者为了根据Kubernetes API验证用户请求。Hi,您可以运行kubect-get-accounts-v=8
来获取端点。以下是@SureshVishnoi的提示标志值(s/kubect/kubectl
)。我创建了与您创建的相同的CRD,并看到此URL:https://192.168.99.103:8443/apis/stable.ibm.com/v1/namespaces/default/accounts
在kubectl get accounts的输出中-v=8
。当Icurl
它(使用适当的--键
,--证书
,--cacert
标志)时,它工作。问题似乎是您正在curl
的URL中有stable.example.com
而不是stable.ibm.com
。