Search code examples
dockerubuntukubernetesminikuberbac

Minikube Running exception when try to enable RBAC in Local PC


I Try to Run this command to start minikube:

minikube start \
         --extra-config=apiserver.Authorization.Mode=RBAC \
         --extra-config=kubelet.cgroup-driver=systemd \
         --driver=docker

And Also Try,

minikube start \
         --extra-config=apiserver.Authorization.Mode=RBAC \
         --driver=docker

But It's giving me errors.
How can I solve this problem...........?

errr like:

stderr:
    [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
    [WARNING Swap]: running with swap on is not supported. Please disable swap
    [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 20.10.7. Latest validated version: 19.03
    [WARNING SystemVerification]: failed to parse kernel config: unable to load kernel module: "configs", output: "modprobe: FATAL: Module configs not found in directory /lib/modules/5.4.0-84-generic\n", err: exit status 1
    [WARNING Service-Kubelet]: kubelet service is not enabled, please run 'systemctl enable kubelet.service'
error execution phase wait-control-plane: couldn't initialize a Kubernetes cluster
To see the stack trace of this error execute with --v=5 or higher

Solution

  • Try to start minikube with --bootstrapper=kubeadm and this will enable RBAC for you

    # Start minikube with kubeadm (Its the default so it's not mandatory)
    minikube start --bootstrapper=kubeadm
    
    # Create the default role binding [kube-system:default]
    kubectl create clusterrolebinding \
            add-on-cluster-admin \
            --clusterrole=cluster-admin \
            --serviceaccount=kube-system:default