Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you enable Feature Gates in K8s?

Tags:

kubernetes

I need to enable a few Feature Gates on my bare-metal K8s cluster(v1.13). I've tried using the kubelet flag --config to enable them, as kubelet --feature-gates <feature gate> throws an error saying that the feature has been deprecated.

I've created a .yml file with the following configuration:

apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
feature-gates:
    VolumeSnapshotDataSource=true

and after running: "kubelet --config , I got the following error:

I0119 21:59:52.987945   29087 server.go:417] Version: v1.14.2
I0119 21:59:52.988165   29087 plugins.go:103] No cloud provider specified.
W0119 21:59:52.988188   29087 server.go:556] standalone mode, no API client
F0119 21:59:52.988203   29087 server.go:265] failed to run Kubelet: no client provided, cannot use webhook authentication

Does anyone know what could be happening and how to fix this problem?

like image 528
Gaby Avatar asked Jan 19 '20 22:01

Gaby


People also ask

How do I enable Kubernetes feature Gates?

You basically need to add the — feature-gate argument to every component of Kubernetes with the list of features you wish to enable. Namely kubelet, kube-apiserver, kube-controller-manager and kube-scheduler.

How do I enable feature Gates OpenShift?

Enabling feature sets using the web console To enable feature sets: In the OpenShift Container Platform web console, switch to the Administration → Custom Resource Definitions page. On the Custom Resource Definitions page, click FeatureGate.

How do I restart kube-Apiserver?

There are cases where the Kubelet did stop the kube-apiserver container but did not start it again. You can force it to do so with systemctl restart kubelet. service . That should attempt to start kube-apiserver and log an error at journalctl if it failed.


1 Answers

You don't apply --feature-gates to the kubelet. You do it to the API-server. Depending on how have you installed kubernetes on bare metal, you would need to either stop API-server, edit the command you start it with and add the following parameter:

--feature-gates=VolumeSnapshotDataSource=true

Or, if it is in a pod, find the manifest, edit it and re-deploy it (it should happen automatically, once you finish editing). It should look like this:

...
  labels:
    component: kube-apiserver
    tier: control-plane
  name: kube-apiserver
  namespace: kube-system
spec:
  containers:
  - command:
    - kube-apiserver
    - --advertise-address=10.132.0.48
    - --allow-privileged=true
    - --authorization-mode=Node,RBAC
    - --client-ca-file=/etc/kubernetes/pki/ca.crt
    - --enable-admission-plugins=NodeRestriction
    - --enable-bootstrap-token-auth=true
    - --etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt
    - --etcd-certfile=/etc/kubernetes/pki/apiserver-etcd-client.crt
    - --etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key
    - --etcd-servers=https://127.0.0.1:2379
    - --insecure-port=0
    - --kubelet-client-certificate=/etc/kubernetes/pki/apiserver-kubelet-client.crt
    - --kubelet-client-key=/etc/kubernetes/pki/apiserver-kubelet-client.key
    - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
    - --proxy-client-cert-file=/etc/kubernetes/pki/front-proxy-client.crt
    - --proxy-client-key-file=/etc/kubernetes/pki/front-proxy-client.key
    - --requestheader-allowed-names=front-proxy-client
    - --requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt
    - --requestheader-extra-headers-prefix=X-Remote-Extra-
    - --requestheader-group-headers=X-Remote-Group
    - --requestheader-username-headers=X-Remote-User
    - --secure-port=6443
    - --service-account-key-file=/etc/kubernetes/pki/sa.pub
    - --service-cluster-ip-range=10.96.0.0/12
    - --tls-cert-file=/etc/kubernetes/pki/apiserver.crt
    - --tls-private-key-file=/etc/kubernetes/pki/apiserver.key
    - --feature-gates=VolumeSnapshotDataSource=true
    image: k8s.gcr.io/kube-apiserver:v1.16.4
    imagePullPolicy: IfNotPresent
    livenessProbe:
      failureThreshold: 8
      httpGet:
        host: 10.132.0.48
        path: /healthz
        port: 6443
        scheme: HTTPS
...
like image 149
suren Avatar answered Oct 09 '22 03:10

suren