Permission denied when starting Minikube on macOS - macos

I am trying to start minikube cluster on my macOS but i get always "Permission denied"
(base) MacBook-Pro-de-..:desktop ..$ minikube start
-bash: /usr/local/bin/minikube: Permission denied
What i should do ?

Execute following commands to add permissions to files:
$ chmod ugo+rwx ~/.kube/config
$ sudo chown -R $USER ~/.kube
$ chmod +x your-minikube-localization
Configure proxy:
export no_proxy=$no_proxy,$(minikube ip)
export NO_PROXY=$no_proxy,$(minikube ip)
Then run minikube command taking proxy under consideration (IPs set below are just example):
$ minikube start --alsologtostderr --kubernetes-version v1.13.1 --docker-env HTTP_PROXY=http://10.0.2.2:1087 --docker-env HTTPS_PROXY=http://10.0.2.2:1087 --docker-env NO_PROXY=10.0.2.2,192.168.99.100
$ minikube start --alsologtostderr --kubernetes-version v1.13.2 --docker-env HTTP_PROXY=http://10.0.2.2:3128 --docker-env HTTPS_PROXY=http://10.0.2.2:3128 --docker-env NO_PROXY=10.0.2.2,192.168.99.100
In this case proxy configuration:
HTTP_PROXY=http://127.0.0.1:3128
Please must remember to add your minikube IP to NO_PROXY.
Similar problems you can find here: file-permission, kubeconfig.

I got now this Error:
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
E0301 15:19:14.198136 48335 start.go:268] Error setting up kubeconfig: Error reading file "/../.kube/config": open /../.kube/config: not a directory
E0301 15:19:15.128758 48335 util.go:151] Error uploading error message: Error sending error report to https://clouderrorreporting.googleapis.com/v1beta1/projects/k8s-minikube/events:report?key=AIzaSyACUwzG0dEPcl-eOgpDKnyKoUFgHdfoFuA, got response code 400

Related

Has anyone also had this status error 255 when running podman?

Is anyone else having this problem when running podman?
I used normally and now when running
podman machine start
this error appears:
Print
I tried to change the podman configuration and increase the resources but I didn't authorize it;
I'm not sure what's going on but here's what I did:
➜ ~ podman system connection list
Name URI Identity Default
podman-machine-default ssh://core#localhost:51014/run/user/501/podman/podman.sock /Users/xxxxx/.ssh/podman-machine-default true
podman-machine-default-root ssh://root#localhost:51014/run/podman/podman.sock /Users/xxxxx/.ssh/podman-machine-default false
➜ ~ podman machine rm podman-machine-default
The following files will be deleted:
/Users/xxxxx/.ssh/podman-machine-default
/Users/xxxxx/.ssh/podman-machine-default.pub
/Users/xxxxx/.config/containers/podman/machine/qemu/podman-machine-default.ign
/Users/xxxxx/.local/share/containers/podman/machine/qemu/podman-machine-default_fedora-coreos-36.20220918.2.2-qemu.x86_64.qcow2
/Users/xxxxx/.local/share/containers/podman/machine/podman-machine-default/podman.sock
/Users/xxxxx/.config/containers/podman/machine/qemu/podman-machine-default.json
Are you sure you want to continue? [y/N] y
➜ ~ podman system connection list
Name URI Identity Default
At this point I switched to the Activity Monitor and killed the qemu service. Then I ran the following:
➜ ~ podman machine init
Downloading VM image: fedora-coreos-37.20230122.2.0-qemu.x86_64.qcow2.xz: done
Extracting compressed file
Image resized.
Machine init complete
To start your machine run:
podman machine start
➜ ~ podman system connection list
Name URI Identity Default
podman-machine-default ssh://core#localhost:51014/run/user/501/podman/podman.sock /Users/xxxxx/.ssh/podman-machine-default true
podman-machine-default-root ssh://root#localhost:51014/run/podman/podman.sock /Users/xxxxx/.ssh/podman-machine-default false
➜ ~ docker machine start
Starting machine "podman-machine-default"
Waiting for VM ...
Mounting volume... /Users/xxxxx:/Users/xxxxx
This machine is currently configured in rootless mode. If your containers
require root permissions (e.g. ports < 1024), or if you run into compatibility
issues with non-podman clients, you can switch using the following command:
podman machine set --rootful
API forwarding listening on: /var/run/docker.sock
Docker API clients default to this address. You do not need to set DOCKER_HOST.
Machine "podman-machine-default" started successfully
Hope this helps.

minikube start time out

i want to run a minikube VM. with following code
minikube start --vm-driver hyperv --hyperv-virtual-switch "minikube_switch" --logtostderr -v7
It keeps running but when i try to ask the minikube status it says this :
E0502 10:12:57.507689 7704 status.go:297] failed to get driver ip: getting IP: IP not found
E0502 10:12:57.509688 7704 status.go:207] status error: getting IP: IP not found
minikube
type: Control Plane
host: Error
kubelet: Nonexistent
apiserver: Nonexistent
kubeconfig: Nonexistent
Can anyone help me with this problem?

Can't run kubectl in docker container from a host machine installed Minikube "The connection to the server 127.0.0.1:32768 was refused"

I want to have a container that can access and run kubectl command on my host machine. Here is what I have:
I have installed Kubernetes and Minikube on my host machine.
I used this docker container: helm-kubectl link
This is the command I run my docker:
docker run -it -v ~/.kube:/root/.kube -v ~/.minikube:/Users/xxxx/.minikube dtzar/helm-kubectl
Inside the container, when I checked the cluster, I can see the context has loaded my minikube, However, I can't run another kubectl command due to the reason "The connection to the server 127.0.0.1:32768 was refused - did you specify the right host or port?".
bash-5.0# kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
docker-desktop docker-desktop docker-desktop
docker-for-desktop docker-desktop docker-desktop
* minikube minikube minikube
bash-5.0# kubectl get all
The connection to the server 127.0.0.1:32768 was refused - did you specify the right host or port?
I have checked my Kubenetes config at ~/.kube and the port is 32768.
- cluster:
certificate-authority: /Users/xxx/.minikube/ca.crt
server: https://127.0.0.1:32768
name: minikube
I have tried port -p 32768 or --expose 32768 but no luck. So anyone can help this?
Thanks zerkms! It works with --network host

How to connect Minikube on Hyperkit on MacBook

I'm trying to connect to Hyperkit to check containers running on this VM.
All I'm getting now is [screen is terminating]
Here is what I do:
MacBook-Pro-Karol: ~
→ minikube start --driver=hyperkit
😄 minikube v1.12.3 na Darwin 10.15.6
✨ Using the hyperkit driver based on user configuration
👍 Starting control plane node minikube in cluster minikube
🔥 Creating hyperkit VM (CPUs=2, Memory=4000MB, Disk=20000MB) ...
🐳 preparing Kubernetes v1.18.3 on Docker 19.03.12...
🔎 Verifying Kubernetes components...
🌟 Enabled addons: default-storageclass, storage-provisioner
🏄 Ready! kubectl is configured to be used with "minikube".
MacBook-Pro-Karol: ~
→ sudo screen /Users/karol/.minikube/machines/minikube/tty
Password:
[screen is terminating]
MacBook-Pro-Karol: ~
→ screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
[screen is terminating]
Cannot exec '/Users/karol/Library/Containers/com.docker.docker/Data/vms/0/tty': Permission denied
→ sudo screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
Password:
[screen is terminating]
Cannot exec '/Users/karol/Library/Containers/com.docker.docker/Data/vms/0/tty': Operation not permitted
Any help would be appreciated.
You can use minikube ssh to login in to VM that minikube runs in:
Log into or run a command on a machine with SSH; similar to
‘docker-machine ssh’.
minikube ssh [flags]
and then use docker ps to check the running containers inside this VM:
$ docker ps | grep kube-api
f53aebd26287 7e28efa976bd "kube-apiserver --ad…" 16 minutes ago k8s_kube-apiserver_kube-apiserver-minikube_kube-system_8009646ba816631d0677c2668886baad_1
12188a523d12 k8s.gcr.io/pause:3.2 "/pause" 16 minutes ago k8s_POD_kube-apiserver-minikube_kube-system_8009646ba816631d0677c2668886baad_1

cannot connect to Minikube on MacOS

I installed minikube as instructed here https://github.com/kubernetes/minikube/releases
and started with with a simple minikube start command.
But the next step, which is as simple as kubectl get pods --all-namespaces fails with
Unable to connect to the server: dial tcp 192.168.99.100:8443: i/o timeout
What did I miss?
I ran into the same issue using my Mac and basically I uninstalled both minikube and Kubectl and installed it as follows:
Installed Minikube.
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.8.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
Installed Kubectl.
curl -Lo kubectl http://storage.googleapis.com/kubernetes-release/release/v1.3.0/bin/darwin/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
Start a cluster, run the command:
minikube start
Minikube will also create a “minikube” context, and set it to default in kubectl. To switch back to this context later, run this command:
kubectl config use-context minikube
Now to get the list of all pods run the command:
kubectl get pods --all-namespaces
Now you should be able to get the list of pods. Also make sure that you don't have a firewall within your network that blocks the connections.
I faced a similar issue on win7 when changed work environment, as you said it is working fine at home but not working at office, high chance it caused by firewall policy, cannot pass TLS verification.
Instead of waste time on troubleshoot(sometimes nothing to do if you cannot turn off firewall), if you just want to test local minikube cluster, would suggest to disable TLS verification.
This is what I have done:
# How to disable minikube TLS verification
## disable TLS verification
$ VBoxManage controlvm minikube natpf1 k8s-apiserver,tcp,127.0.0.1,8443,,8443
$ VBoxManage controlvm minikube natpf1 k8s-dashboard,tcp,127.0.0.1,30000,,30000
$ kubectl config set-cluster minikube-vpn --server=https://127.0.0.1:8443 --insecure-skip-tls-verify
$ kubectl config set-context minikube-vpn --cluster=minikube-vpn --user=minikube
$ kubectl config use-context minikube-vpn
## test kubectl
$ kubectl get pods
## enable local docker client
$ VBoxManage controlvm minikube natpf1 k8s-docker,tcp,127.0.0.1,2374,,2376
$ eval $(minikube docker-env)
$ unset DOCKER_TLS_VERIFY
$ export DOCKER_HOST="tcp://127.0.0.1:2374"
$ alias docker='docker --tls'
## test local docker client
$ docker ps
## test minikube dashboard
curl http://127.0.0.1:30000
Also I make a small script for this for your reference.
Hope it is helpful for you.
You need to just restart minikube. Sometimes I have this problem when my computer has been off for a while. I don't think you need to reinstall anything.
First verify you are in the correct context
$ kubectl config current-context
minikube
Check Minikube status (status should show "Running", mine below showed "Saved")
$ minikube status
minikube: Saved
cluster:
kubectl:
Restart minikube
$ minikube start
Starting local Kubernetes v1.8.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Verify it is running (This is what you should see)
$ minikube status
minikube: Running
cluster: Running
kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.100
I had this issue when connected to Cisco AnyConnect VPN. Once I disconnected, minikube ran fine. Discussion on github here: https://github.com/kubernetes/minikube/issues/4540

Resources