Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting minikube with a custom kube-apiserver image #8421

Closed
yuvalavra opened this issue Jun 9, 2020 · 8 comments
Closed

Starting minikube with a custom kube-apiserver image #8421

yuvalavra opened this issue Jun 9, 2020 · 8 comments
Labels
kind/support Categorizes issue or PR as a support question.

Comments

@yuvalavra
Copy link

I would like to test a custom kube-apiserver with minikube, is there a way to configure minikube to use my image instead of the default one (k8s.gcr.io/kube-apiserver-amd64:$version)?

Thanks

@medyagh
Copy link
Member

medyagh commented Jun 9, 2020

@yuvalavra there is a way to provide your own image registry to minikube, but minikube will look for same image and tag that it expects for each kuberentes version, but if you have your own custom image with same name:tag minikube will use that

      --image-mirror-country='': Country code of the image mirror to be used. Leave empty to use the global one. For Chinese mainland users, set it to cn.
      --image-repository='': Alternative image repository to pull docker images from. This can be used when you have limited access to gcr.io. Set it to "auto" to let minikube decide one for you. For Chinese mainland users, you may use local gcr.io mirrors such as registry.cn-hangzhou.aliyuncs.com/google_containers
      --preload=true: If set, download tarball of preloaded images if available to improve start time. Defaults to true.

@medyagh medyagh added the kind/support Categorizes issue or PR as a support question. label Jun 9, 2020
@prasadkatti
Copy link
Contributor

prasadkatti commented Jun 10, 2020

So basically you will have to use a custom image repository. You will need to upload all the official images there. Then tag your custom apiserver image to have the same name:tag as the official image for the k8s version you are using and upload that. minikube will then use your custom apiserver image.

@yuvalavra
Copy link
Author

Got it, thanks

@prasadkatti
Copy link
Contributor

@yuvalavra - Please let us know if the solution proposed above works for you.

@prasadkatti
Copy link
Contributor

There was an issue (#4104) filed to pull images using tag@hash which was never fixed. That would have made the above workaround unusable. Just an FYI.

@yuvalavra
Copy link
Author

Thanks @prasadkatti. I eventually opted to replace the apiserver on the run through the kubelet's manifest directory.

@medyagh
Copy link
Member

medyagh commented Jul 15, 2020

@yuvalavra do you mind sharing what you did this might be helpful to other users ? or potentially we can add it to our advanced tutorials https://minikube.sigs.k8s.io/docs/tutorials/

@yuvalavra
Copy link
Author

yuvalavra commented Jul 15, 2020

@medyagh Gladly, but do know it's a bit hacky and I have no idea whether it'll work for all minikube/k8s versions.

  1. Start minikube as usual
  2. In the VM, change the image field in the apiserver yaml file to your custom apiserver image (the yaml file should reside in the kubelet's static pods directory at /etc/kubernetes/manifests/kube-apiserver.yaml)
  3. Rename the apiserver yaml file to kube-apiserver2.yaml (just needs to be a different name).
  4. The kubelet should now notice the old yaml doesn't exist and a new one was created, it'll remove the old apiserver pod and create a new one according to the new yaml file (which now specifies your custom image)

This will only work if the minikube version deploys the apiserver as a static pod, I don't know if all versions do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

No branches or pull requests

3 participants