Kubevirt: How to pass flags to kube-api-master

Created on 29 Jan 2018  路  3Comments  路  Source: kubevirt/kubevirt

For the implementation of https://github.com/kubevirt/kubevirt/pull/652, a change is required to core Kubernetes. Because the initializers feature of Kubernetes is still alpha, in order to use it, a flag passed to kube-apiserver is required to enable it.

--runtime-config=admissionregistration.k8s.io/v1alpha1

This is currently being implemented as a call to patch to edit /etc/kubernetes/manifests/kube-apiserver.yaml inside each vagrant node, however I believe there's a more programmatic means of passing in command line flags.

Most helpful comment

For my case:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:46:06Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:36:14Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}

I have edited the file /etc/kubernetes/manifests/kube-apiserver.yaml. For example, I have enabled DefaultStorageClass

- --enable-admission-plugins=NodeRestriction,DefaultStorageClass

Then,

docker rm -f `docker ps | grep apiserver | awk '{print $1}'`
systemctl restart kubelet

All 3 comments

Thanks @rmohr. For anybody else looking into this, there is no command line flag to kubeadm to add extra arguments to the various components. The only mechanism for doing so is to provide a kubeadm config file. Command line arguments cannot be mixed in--if you switch to using a config, all parameters must be passed in that way.

apiVersion: kubeadm.k8s.io/v1alpha1
kind: MasterConfiguration
apiServerExtraArgs:
  runtime-config: admissionregistration.k8s.io/v1alpha1
pod-network-cidr: 10.244.0.0/16

For my case:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:46:06Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:36:14Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}

I have edited the file /etc/kubernetes/manifests/kube-apiserver.yaml. For example, I have enabled DefaultStorageClass

- --enable-admission-plugins=NodeRestriction,DefaultStorageClass

Then,

docker rm -f `docker ps | grep apiserver | awk '{print $1}'`
systemctl restart kubelet
Was this page helpful?
0 / 5 - 0 ratings

Related issues

enp0s3 picture enp0s3  路  6Comments

shubhindia picture shubhindia  路  6Comments

bitbucket90 picture bitbucket90  路  9Comments

gageorsburn picture gageorsburn  路  10Comments

cynepco3hahue picture cynepco3hahue  路  11Comments