0

所以我一直在关注本教程(https://www.youtube.com/watch?v=KBTXBUVNF2I),在设置协调器后,当我执行“make run”时,我收到以下错误:

/Users/sourav/go/bin/controller-gen object:headerFile=./hack/boilerplate.go.txt paths="./..."
go fmt ./...
go vet ./...
/Users/sourav/go/bin/controller-gen "crd:trivialVersions=true" rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
go run ./main.go
2020-03-15T22:13:29.111+0530 INFO controller-runtime.metrics metrics server is starting to listen {"addr": ":8080"}
2020-03-15T22:13:29.112+0530 INFO setup starting manager
2020-03-15T22:13:29.113+0530 INFO controller-runtime.manager starting metrics server {"path": "/metrics"}
2020-03-15T22:13:29.213+0530 INFO controller-runtime.controller Starting EventSource {"controller": "guestbook", "source": "kind source: /, Kind="}
2020-03-15T22:13:29.213+0530 INFO controller-runtime.controller Starting EventSource {"controller": "redis", "source": "kind source: /, Kind="}
2020-03-15T22:13:29.213+0530 INFO controller-runtime.controller Starting EventSource {"controller": "guestbook", "source": "kind source: /, Kind="}
2020-03-15T22:13:29.315+0530 INFO controller-runtime.controller Starting EventSource {"controller": "redis", "source": "kind source: /, Kind="}
2020-03-15T22:13:29.315+0530 INFO controller-runtime.controller Starting EventSource {"controller": "guestbook", "source": "kind source: /, Kind="}
2020-03-15T22:13:29.418+0530 INFO controller-runtime.controller Starting EventSource {"controller": "guestbook", "source": "kind source: /, Kind="}
2020-03-15T22:13:29.418+0530 INFO controller-runtime.controller Starting EventSource {"controller": "redis", "source": "kind source: /, Kind="}
2020-03-15T22:13:29.418+0530 INFO controller-runtime.controller Starting Controller {"controller": "guestbook"}
2020-03-15T22:13:29.418+0530 INFO controller-runtime.controller Starting Controller {"controller": "redis"}
2020-03-15T22:13:29.519+0530 INFO controller-runtime.controller Starting workers {"controller": "redis", "worker count": 1}
2020-03-15T22:13:29.519+0530 INFO controllers.Redis reconciling redis {"redis": "default/redis-sample"}
2020-03-15T22:13:29.523+0530 INFO controller-runtime.controller Starting workers {"controller": "guestbook", "worker count": 1}
2020-03-15T22:13:29.527+0530 ERROR controller-runtime.controller Reconciler error {"controller": "redis", "request": "default/redis-sample", "error": "415: Unsupported Media Type"}
github.com/go-logr/zapr.(*zapLogger).Error
/Users/sourav/go/pkg/mod/github.com/go-logr/zapr@v0.1.0/zapr.go:128
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
/Users/sourav/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:258
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
/Users/sourav/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:232
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker
/Users/sourav/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.4.0/pkg/internal/controller/controller.go:211
k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1
/Users/sourav/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190913080033-27d36303b655/pkg/util/wait/wait.go:152
k8s.io/apimachinery/pkg/util/wait.JitterUntil
/Users/sourav/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190913080033-27d36303b655/pkg/util/wait/wait.go:153
k8s.io/apimachinery/pkg/util/wait.Until
/Users/sourav/go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190913080033-27d36303b655/pkg/util/wait/wait.go:88
2020-03-15T22:13:30.528+0530 INFO controllers.Redis reconciling redis {"redis": "default/redis-sample"}
2020-03-15T22:13:30.548+0530 ERROR controller-runtime.controller Reconciler error {"controller": "redis", "request": "default/redis-sample", "error": "415: Unsupported Media Type"}

该错误似乎来自这一行:

https://github.com/DirectXMan12/kubebuilder-workshops/blob/605890232fb368a8ff00ac5e9879c8dfd90f904c/controllers/redis_controller.go#L73

任何想法可能导致此错误以及如何解决它?

4

1 回答 1

1

那是使用一个相对较新的特性,确保你的 kubernetes 是最新的并且启用了服务器端应用。

于 2020-03-15T18:52:16.737 回答