How to modify source code and deploy Kubernetes

6/11/2018

I am modifying the source code of the kubelet. For compiling, I can do make quick-release. And I can get the executable kubelet from the _output

Then I replace the original /usr/bin/kubelet with the new executable, but when I run kubeadm init, it gives me the error message:

[preflight] Some fatal errors occurred: [ERROR KubeletVersion]: couldn't get kubelet version: Unable to parse output from Kubelet: "Kubernetes v0.0.0-master+$Format:%h

quot;

I believe there must be a standard way to compile and deploy Kubernetes. My googled resource are mostly about developing application on Kubernetes. Can anyone give me a guide or give some keywords so I can google on my own?

Thanks

--

Update

I replaced the kubelet in minikube env.

And I got the permission error.

W0613 16:34:55.917805 26616 status_manager.go:496] Failed to update status for pod "kube-apiserver-minikube_kube-system(5ff9a836-6f27-11e8-8667-080027c176b2)": failed to patch status "{\"status\":{\"$setElementOrder/conditions\":[{\"type\":\"Initialized\"},{\"type\":\"Ready\"},{\"type\":\"PodScheduled\"}],\"conditions\":[{\"lastTransitionTime\":\"2018-06-13T16:34:51Z\",\"status\":\"True\",\"type\":\"Ready\"}]}}" for pod "kube-system"/"kube-apiserver-minikube": pods "kube-apiserver-minikube" is forbidden: User "system:node:minikube" cannot patch pods/status in the namespace "kube-system"

--

Update again

I found that it's the version inconsistent problem. Once I checkout the same version of the Kubernete in minikube git checkout v1.10.0, then the problem is solved.

-- chinuy
kubernetes

1 Answer

6/12/2018

try

cd $GOPATH/src/k8s.io/kubernetes
make clean
# use the version you used, like v1.9.2-123
git tag v1.x.x-xxxx
make kubelet
# should show the above tag
_output/bin/kubelet --version

If you just modified source code of a single component, you doesn't need to make quick-release, just make <componenet_name> (for example, make kubelet,make kube-proxy...). And you just need to tag once (the tag should be there after new changes made to the source code).

-- wineinlib
Source: StackOverflow