Are there minikube args that could be applied to all minikube start calls? - minikube

I tend to run minikube start with a handful of flags. Like --memory and --cpus and --kubernetes-verison. I'd like to specify this in a file and not have to create a shell script that makes this start-up simple and consistent. Does such a thing already exists in some capacity?

The best option is use minikube config to customize the minikube startup.
The command minikube config writes a file in ~/.minikube/config/config.json and you can set options using miikube config set [OPTION] [VALUE].
Here you can find a list of available commands.
To set the parameters mentioned in your post, you need to use:
minikube config set memory xxx
minikube config set cpus xxx
minikube config set kubernetes-version xxx
Please refer to documentation page to get all options.

Related

kubeadm init --config issue

I'm trying to init a kubernetes cluster using kubeadm. I followed the instructions found here for the stacked control plane/etcd nodes. For the container runtime installation, it is recommended that the runtime (in my case, containerd) and kubelet use the same cgroup driver (in my case, systemd).
Still following the instructions, I added
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
...
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
to /etc/containerd/config.toml and then restarted containerd using sudo systemctl restart containerd
So far so good, everything work as expected. Then I get to the part where I have to configure cgroup driver used by kubelet. It says I have to call kubeadm init with a config file. Something like: sudo kubeadm init --config.yaml. Here is my problem: I found very little information about what should that config file look like. The documentation says kubeadm config print init-defaults should print the default config but the default config has nothing to do with my setup (ie, it uses docker instead of containerd). I found an example of a file here but so far I've not managed to adapt it to my setup and I've found very little documentation to do so. There has to be a simpler way than just rewriting an entire config file just for one attribute change, right? How come I can't print the literal config file used by kubeadm init?
My solution was to restart containerd with default config (no systemd cgroup), then run kubeadm init as I would normally. Once the cluster was started, I printed the config to a file with: kubeadm config view. I then modified that file to add the required parameters to set systemd cgroup. Finally, I configured containerd to use systemd and ran kubeadm init with the newly created config file. Everything worked.
Warning: The command kubeadm config view says that the "view" command is deprecated and to use kubectl get cm -o yaml -n kube-system kubeadm-config instead, but the output of that command doesn't create a valid kubeadm config file, so I don't recommend doing that.

minikube failed to start

Hello so i was using yesterday minikube and it was working fine but today i was trying to start with minikube start command and it give the following errors :
and after running minikube status it give the following result :
Thanks in advance for any help.
You are getting the following error:
Exiting due to GUEST_START: Failed kubeconfig update: could not read config: Error decoding config from data control character are not allowed
and
getting k8s client: client config: error loading config file "C:\Users<Your User>/.kube/config control characters are not allowed
Those errors indicates that your $KUBECONFIG has an invalid character in it.
Troubleshooting
For the future use, please provide more detailed information. It's well described in Minikube Troubleshooting. The following commands might provide useful information for troubleshooting:
$ minikube logs
$ minikube start --alsologtostderr -v=2
$ kubectl config view
In minikube output there is also updating the running virtualbox "minikube" VM It might be related with network changes.
Possible Solution
Remove config file from C:\Users\<Your User>/.kube/ and start minikube again.
Update your Minikube to newest version (current is 1.16).
Recreate your minikube cluster using minikube delete and create new one.
Execite minikube update context.

Location of Kubernetes config directory with Docker Desktop on Windows

I am running a local Kubernetes cluster through Docker Desktop on Windows. I'm attempting to modify my kube-apiserver config, and all of the information I've found has said to modify /etc/kubernetes/manifests/kube-apiserver.yaml on the master. I haven't been able to find this file, and am not sure what the proper way is to do this. Is there a different process because the cluster is through Docker Desktop?
Is there a different process because the cluster is through Docker Desktop?
You can get access to the kubeapi-server.yaml with a Kubernetes that is running on Docker Desktop but in a "hacky" way. I've included the explanation below.
For setups that require such reconfigurations, I encourage you to use different solution like for example minikube.
Minikube has a feature that allows you to pass the additional options for the Kubernetes components. You can read more about --extra-config ExtraOption by following this documentation:
Minikube.sigs.k8s.io: Docs: Commands: Start
As for the reconfiguration of kube-apiserver.yaml with Docker Desktop
You need to run following command:
docker run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
Above command will allow you to run:
vi /etc/kubernetes/manifests/kube-apiserver.yaml
This lets you edit the API server configuration. The Pod running kubeapi-server will be restarted with new parameters.
You can check below StackOverflow answers for more reference:
Stackoverflow.com: Answer: Where are the Docker Desktop for Windows kubelet logs located?
Stackoverflow.com: Answer: How to change the default nodeport range on Mac (docker-desktop)?
I've used this answer without $ screen command and I was able to reconfigure kubeapi-server on Docker Desktop in Windows

Minikube "start" command is not creating vm or cluster(See Screen Shot)

I am trying to runminikube start--vm - driver = virtualbox orminikube start--vm - driver = hyperv by enabling the hyper - visor, but i am getting below error.
Can Someone please take me out of this:
For future, please try to post text instead of pic in your question. Second thing is that you are using quite old versions.
Usually errors like:
status error: host: state: machine does not exist minikube windows
The "minikube" host does not exist
are shown where you have some "leftovers" from previous minikube cluster.
It's hard to determine root cause exactly as it would need exact steps you have performed.
1. Delete previous minikube and start again
You have to use command like:
minikube delete
if you specified name of cluster using
minikube delete -p <your-cluster-name>
After that you should start minikube again.
minikube start --vm-driver=<depends-on-your-needs>
Here you have all drivers you can use with minikube.
2. Use --force flag.
It would look like:
minikube start --vm-driver=hyperv --force
but it's also recommended to user minikube delete before this command.
3. Steps to run Minikube on Windows.
As you mentioned you already have docker, but if you would need to reinstall, you can find good tutorial on Docker official docs.
Good tutorial, how run Minikube on Windows 10 can be found here.
You can also check this StackOverflow thread for more updated version.
4. Further issues with starting minikube
If you will still have issues with running minikube, please update your question with debug logs. It can be found here.
minikube start --vm-driver=hyberv --v=7
or
minikube logs

minikube - How to know the name of the minikube VM being used?

I want to use minikube ssh [flags] command
There is Global Flag:
-p, --profile string The name of the minikube VM being used.
So, I need to know the name of the minikube VM. How to do this?
Profiles feature on some stacks are broken since 0.26.0, and still with version 0.28.2. #2818, #2574
Without setting a profile the default profile will create a VM called "minikube".
minikube profile default
minikube profile was successfully set to minikube
Set the profile to another name,
minikube profile experiment
then view the profile set with
minikube config view
and create a new Minikube VM with that profile name
minikube start --profile experiment
With the profile set to "experiment", the VM created in VirtualBox will (should) be named "experiment".
Minikube is a tool that makes it easy to run Kubernetes locally. Minikube runs a single-node Kubernetes cluster inside a VM on your laptop for users looking to try out Kubernetes or develop with it day-to-day.
Parameter "-p", that you mentioned, is used to name the VM where minikube creates a Kubernetes stack. Omitting this parameter presupposes default value "minikube".
For the system running minikube with the support of the VirtualBox:
VBoxManage list runningvms
First returned value is the name of minikube instance. I assume there is no other
VirtualBox session running.
Next, you can use this name to:
minikube ssh <name>
When you create minikube with -p parameter, to manage this setup you must use -p
with every minikube command call. This parameter is useful for multiple minikube instances running on the same host.