kubernetes / sample-apiserver

Reference implementation of an apiserver for a custom Kubernetes API.
Apache License 2.0
533 stars 212 forks source link

Walkthrough for setting up the apiserver in minikube or oc cluster up #8

Closed maleck13 closed 7 years ago

maleck13 commented 7 years ago

Having gotten a much better understanding of what an apiserver is in Kubernetes, thanks to this repo. I was able to create my own and also able to get it running outside a kubernetes cluster talking to a local etcd. This in its self may be useful to document. However when it came to trying to get it running in a local Kubernetes cluster. I hit a bit of brick wall. I think a detailed example of how to get it running in something like minikube or oc cluster up would go along way to helping adoption of api extension.

luxas commented 7 years ago

@maleck13 Have you seen https://github.com/luxas/kubeadm-workshop? Especially https://github.com/luxas/kubeadm-workshop/blob/master/demos/sample-apiserver/wardle.yaml...

maleck13 commented 7 years ago

@luxas Thanks will take a look

maleck13 commented 7 years ago

@luxas The demo objects could be useful. I have something very similar. I was thinking about local development. In the doc here: https://kubernetes.io/docs/tasks/access-kubernetes-api/setup-extension-api-server/ https://kubernetes.io/docs/tasks/access-kubernetes-api/configure-aggregation-layer/ there are quite a few pre reqs called out and flags to set without much additional detail. Understanding how to set these flags and setup the certs etc along with tips on debugging would be very useful for developers looking to get started with an apiserver. I think a walkthrough starting from minikube start to you can not create an object with the following command would be very useful. I am currently trying to make my way from 0 to having an apiserver and have definitely struggled in places (still not there yet). Once I get there, I would be happy to contribute such a guide.

luxas commented 7 years ago

@maleck13 Configuring the API server in a specific way and generating certs is involved. kubeadm does that for you automatically. Related lines of code: https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/phases/certs/certs.go#L93-L121 https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/phases/controlplane/manifests.go#L310-L316

qrtp commented 7 years ago

@maleck13 agreed on your suggestion about a walkthrough from minikube start. Were you able to take notes or have a rough guide based on your experience?

maleck13 commented 7 years ago

@qrtp Yes. The main issue I hit was around the requestheader-client-ca-file. Which looks to solved in a recent PR https://github.com/kubernetes/minikube/pull/1918 https://github.com/kubernetes/minikube/issues/1404

While this will simplify things. I still think having a walkthrough from: I just cloned this repo to I have created my own resource type would be useful. I will take this on this week. The other area I think would be useful is local development and testing. Perhaps follow on from this issue

qrtp commented 7 years ago

@maleck13 Many thanks! I'm currently approaching it from the local development route, and commented out the authentication and authorization ApplyTo callbacks to avoid the cert details for now.