Kubernetes PodPreset无法正常工作

时间:2017-06-27 14:58:10

标签: kubernetes

我想在运行1.6.6版的测试群集上使用PodPreset Kubernetes功能。 Kube-apiserver以(仅包括相关部分)开头:



--storage-backend=etcd2 
--admission-control ...,PodPreset 
--runtime-config=settings.k8s.io/v1alpha1/podpreset




但是我仍然得到:



Jun 27 16:34:25 host kube-apiserver[22088]: I0627 16:34:25.701156   22088 reflector.go:236] Listing and watching *settings.PodPreset from k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/factory.go:70
Jun 27 16:34:25 host kube-apiserver[22088]: I0627 16:34:25.701487   22088 round_trippers.go:398] curl -k -v -XGET  -H "Accept: application/vnd.kubernetes.protobuf, */*" -H "User-Agent: kube-apiserver/v1.6.6 (linux/amd64) kubernetes/7fa1c17" -H "Authorization: Bearer XXX” https://A.B.C.D:443/apis/settings.k8s.io/v1alpha1/podpresets?resourceVersion=0
Jun 27 16:34:25 host kube-apiserver[22088]: I0627 16:34:25.702702   22088 wrap.go:75] GET /apis/settings.k8s.io/v1alpha1/podpresets?resourceVersion=0: (266.839µs) 404 [[kube-apiserver/v1.6.6 (linux/amd64) kubernetes/7fa1c17] A.B.C.D:37122]
Jun 27 16:34:25 host kube-apiserver[22088]: I0627 16:34:25.703446   22088 round_trippers.go:417] GET https://A.B.C.D:443/apis/settings.k8s.io/v1alpha1/podpresets?resourceVersion=0 404 Not Found in 1 milliseconds
Jun 27 16:34:25 host kube-apiserver[22088]: I0627 16:34:25.703483   22088 round_trippers.go:423] Response Headers:
Jun 27 16:34:25 host kube-apiserver[22088]: I0627 16:34:25.703502   22088 round_trippers.go:426]     Content-Type: application/vnd.kubernetes.protobuf
Jun 27 16:34:25 host kube-apiserver[22088]: I0627 16:34:25.703515   22088 round_trippers.go:426]     Content-Length: 112
Jun 27 16:34:25 host kube-apiserver[22088]: I0627 16:34:25.703527   22088 round_trippers.go:426]     Date: Tue, 27 Jun 2017 14:34:25 GMT
Jun 27 16:34:25 host kube-apiserver[22088]: I0627 16:34:25.703606   22088 request.go:989] Response Body:
Jun 27 16:34:25 host kube-apiserver[22088]: 00000000  6b 38 73 00 0a 0c 0a 02  76 31 12 06 53 74 61 74  |k8s.....v1..Stat|
Jun 27 16:34:25 host kube-apiserver[22088]: 00000010  75 73 12 58 0a 04 0a 00  12 00 12 07 46 61 69 6c  |us.X........Fail|
Jun 27 16:34:25 host kube-apiserver[22088]: 00000020  75 72 65 1a 30 74 68 65  20 73 65 72 76 65 72 20  |ure.0the server |
Jun 27 16:34:25 host kube-apiserver[22088]: 00000030  63 6f 75 6c 64 20 6e 6f  74 20 66 69 6e 64 20 74  |could not find t|
Jun 27 16:34:25 host kube-apiserver[22088]: 00000040  68 65 20 72 65 71 75 65  73 74 65 64 20 72 65 73  |he requested res|
Jun 27 16:34:25 host kube-apiserver[22088]: 00000050  6f 75 72 63 65 22 08 4e  6f 74 46 6f 75 6e 64 2a  |ource".NotFound*|
Jun 27 16:34:25 host kube-apiserver[22088]: 00000060  08 0a 00 12 00 1a 00 28  00 30 94 03 1a 00 22 00  |.......(.0....".|
Jun 27 16:34:25 host kube-apiserver[22088]: E0627 16:34:25.703783   22088 reflector.go:201] k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/factory.go:70: Failed to list *settings.PodPreset: the server could not find the requested resource




显然,当我尝试通过kubectl提交我的资源时,它会失败。



error: error validating "pod-preset.yaml": error validating data: found invalid field resources for v1alpha1.PodPresetSpec; if you choose to ignore these errors, turn validation off with --validate=false




群集本身正常运行(我有多个服务和pod)。有什么想法吗?

2 个答案:

答案 0 :(得分:1)

" settings.k8s.io/v1alpha1"默认情况下,在1.6.x中启用API端点。所以你不需要在runtime-config参数中指定。

你可以试试而不在" runtime-config"中指定任何内容。参数。您只需要在录取控制中使用PodPreset。

答案 1 :(得分:0)

建议:

minikube stop

minikube start --extra-config=apiserver.runtime-config=settings.k8s.io/v1alpha1=true

现在重试使用podpreset。它对我有用。