kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.56k stars 4.89k forks source link

Minikube 1.34.0 fails to start in GitHub Action #19698

Closed mprimeaux closed 1 month ago

mprimeaux commented 2 months ago

What Happened?

We use Minikube in our CI pipeline, which worked fine until we upgraded the GitHub Actions workflow to use Minikube 1.34.0 from 1.33.1.

TL;DR: Error: Command failed: sudo chown -R $USER $HOME/.kube /home/runner/work/_temp/.minikube

Here is the error:

exception ```shell Run manusa/actions-setup-minikube@v2.11.0 with: driver: docker container runtime: docker minikube version: v1.34.0 kubernetes version: 1.30.5 start args: --addons registry --memory 2048 --cpus 2 github token: *** env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true X_K8S_NAMESPACE_PREFIX: platform X_HOME: platform/platform/ CONTAINER_REGISTRY: ghcr.io X_OPERATIONAL_BAND: ci Loading input variables Updating Environment configuration to support Minikube WARNING: apt does not have a stable CLI interface. Use with caution in scripts. Get:1 file:/etc/apt/apt-mirrors.txt Mirrorlist [142 B] Hit:6 https://packages.microsoft.com/repos/azure-cli jammy InRelease Hit:2 http://azure.archive.ubuntu.com/ubuntu jammy InRelease Get:7 https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease [3632 B] Get:3 http://azure.archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB] Hit:4 http://azure.archive.ubuntu.com/ubuntu jammy-backports InRelease Get:5 http://azure.archive.ubuntu.com/ubuntu jammy-security InRelease [129 kB] Get:8 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main arm64 Packages [43.5 kB] Get:9 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 Packages [173 kB] Get:10 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main armhf Packages [15.6 kB] Get:11 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [2062 kB] Get:12 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [356 kB] Get:13 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main amd64 c-n-f Metadata [17.8 kB] Get:14 http://azure.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [2499 kB] Get:15 http://azure.archive.ubuntu.com/ubuntu jammy-updates/restricted Translation-en [430 kB] Get:16 http://azure.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1125 kB] Get:17 http://azure.archive.ubuntu.com/ubuntu jammy-updates/universe Translation-en [262 kB] Get:18 http://azure.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 c-n-f Metadata [26.1 kB] Get:19 http://azure.archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1844 kB] Get:20 http://azure.archive.ubuntu.com/ubuntu jammy-security/main Translation-en [298 kB] Get:21 http://azure.archive.ubuntu.com/ubuntu jammy-security/main amd64 c-n-f Metadata [13.3 kB] Get:22 http://azure.archive.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [2439 kB] Get:23 http://azure.archive.ubuntu.com/ubuntu jammy-security/restricted Translation-en [420 kB] Get:24 http://azure.archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [905 kB] Get:25 http://azure.archive.ubuntu.com/ubuntu jammy-security/universe Translation-en [177 kB] Get:26 http://azure.archive.ubuntu.com/ubuntu jammy-security/universe amd64 c-n-f Metadata [19.3 kB] Fetched 13.4 MB in 2s (6904 kB/s) Reading package lists... Building dependency tree... Reading state information... 50 packages can be upgraded. Run 'apt list --upgradable' to see them. Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: conntrack 0 upgraded, 1 newly installed, 0 to remove and 50 not upgraded. Need to get 33.5 kB of archives. After this operation, 104 kB of additional disk space will be used. Get:1 file:/etc/apt/apt-mirrors.txt Mirrorlist [142 B] Get:2 http://azure.archive.ubuntu.com/ubuntu jammy/main amd64 conntrack amd64 1:1.4.6-2build2 [33.5 kB] Fetched 33.5 kB in 0s (842 kB/s) Selecting previously unselected package conntrack. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 266920 files and directories currently installed.) Preparing to unpack .../conntrack_1%3a1.4.6-2build2_amd64.deb ... Unpacking conntrack (1:1.4.6-2build2) ... Setting up conntrack (1:1.4.6-2build2) ... Processing triggers for man-db (2.10.2-1) ... NEEDRESTART-VER: 3.5 NEEDRESTART-KCUR: 6.8.0-1014-azure NEEDRESTART-KEXP: 6.8.0-1014-azure NEEDRESTART-KSTA: 1 fs.protected_regular = 0 Waiting for Docker to be ready 26.1.3 - 26.1.3 Docker daemon is ready Downloading Minikube v1.34.0 Downloading from: https://github.com/kubernetes/minikube/releases/download/v1.34.0/minikube-linux-amd64 Installing Minikube * minikube v1.34.0 on Ubuntu 22.04 - MINIKUBE_HOME=/home/runner/work/_temp * Using the docker driver based on user configuration * Using Docker driver with root privileges * Starting "minikube" primary control-plane node in "minikube" cluster * Pulling base image v0.0.45 ... * Downloading Kubernetes v1.30.5 preload ... * Creating docker container (CPUs=2, Memory=2048MB) ... * Preparing Kubernetes v1.30.5 on Docker 27.2.0 ... - Generating certificates and keys ... - Booting up control plane ... - Configuring RBAC rules ... * Configuring bridge CNI (Container Networking Interface) ... * Verifying Kubernetes components... - Using image docker.io/registry:2.8.3 - Using image gcr.io/k8s-minikube/kube-registry-proxy:0.0.6 - Using image gcr.io/k8s-minikube/storage-provisioner:v5 * Verifying registry addon... * Enabled addons: storage-provisioner, default-storageclass, registry * Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default > gcr.io/k8s-minikube/kicbase...: 0 B [_______________________] ?% ? p/s ? > gcr.io/k8s-minikube/kicbase...: 1.61 KiB / 487.90 MiB [>_] 0.00% ? p/s ? > gcr.io/k8s-minikube/kicbase...: 11.78 MiB / 487.90 MiB [>] 2.41% ? p/s ? > gcr.io/k8s-minikube/kicbase...: 49.25 MiB / 487.90 MiB 10.09% 82.12 MiB > gcr.io/k8s-minikube/kicbase...: 93.67 MiB / 487.90 MiB 19.20% 82.12 MiB > gcr.io/k8s-minikube/kicbase...: 134.78 MiB / 487.90 MiB 27.63% 82.12 Mi > gcr.io/k8s-minikube/kicbase...: 174.69 MiB / 487.90 MiB 35.80% 90.31 Mi > gcr.io/k8s-minikube/kicbase...: 217.33 MiB / 487.90 MiB 44.54% 90.31 Mi > gcr.io/k8s-minikube/kicbase...: 261.05 MiB / 487.90 MiB 53.50% 90.31 Mi > gcr.io/k8s-minikube/kicbase...: 303.56 MiB / 487.90 MiB 62.22% 98.34 Mi > gcr.io/k8s-minikube/kicbase...: 340.14 MiB / 487.90 MiB 69.72% 98.34 Mi > gcr.io/k8s-minikube/kicbase...: 386.30 MiB / 487.90 MiB 79.18% 98.34 Mi > gcr.io/k8s-minikube/kicbase...: 431.71 MiB / 487.90 MiB 88.48% 105.7 Error: Command failed: sudo chown -R $USER $HOME/.kube /home/runner/work/_temp/.minikube Error: Command failed: sudo chown -R $USER $HOME/.kube /home/runner/work/_temp/.minikube at genericNodeError (node:internal/errors:984:15) at wrappedFn (node:internal/errors:538:14) at checkExecSyncError (node:child_process:890:11) at Object.execSync (node:child_process:962:15) at logExecSync (/home/runner/work/_actions/manusa/actions-setup-minikube/v2.11.0/src/exec.js:8:17) at install (/home/runner/work/_actions/manusa/actions-setup-minikube/v2.11.0/src/install.js:30:3) at async run (/home/runner/work/_actions/manusa/actions-setup-minikube/v2.11.0/src/index.js:16:3) { status: 1, signal: null, output: [ null, null, null ], pid: 6354, stdout: null, stderr: null } Error: Command failed: sudo chown -R $USER $HOME/.kube /home/runner/work/_temp/.minikube ```

It appears to fail on line 914 in pkg/minikube/node/start.go. Reverting back to Minikube 1.33.1 works as expected. What is odd is I'm not using the none driver and this line seems to only be called when using the none driver.

Here is an excerpt from our GitHub Actions workflow:

      # Ref: https://github.com/manusa/actions-setup-minikube
      - name: Install Minikube
        uses: manusa/actions-setup-minikube@v2.11.0
        with:
          driver: docker
          container runtime: docker
          minikube version: 'v1.34.0'
          kubernetes version: '1.30.5'
          start args: "--addons registry --memory 2048 --cpus 2"
          github token: ${{ secrets.GHCR_TOKEN }}

The OS is ubuntu-latest (Ubuntu 22.04), which is supported by actions-setup-minikube.

After a bit of debugging, it turns the folder $HOME/.kube /home/runner/work/_temp/.minikube didn't yet exist and so I simply added a pre-requisite step in the workflow to create the folder, which addressed the issue.

mkdir -p $HOME/.kube /home/runner/work/_temp/.minikube

I assume a check can be added to ensure the directory exists before executing the command will resolve this issue. The fix MAY prefer to create the directory is it does not exist.

Attach the log file

exception ```shell Run manusa/actions-setup-minikube@v2.11.0 with: driver: docker container runtime: docker minikube version: v1.34.0 kubernetes version: 1.30.5 start args: --addons registry --memory 2048 --cpus 2 github token: *** env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true X_K8S_NAMESPACE_PREFIX: platform X_HOME: platform/platform/ CONTAINER_REGISTRY: ghcr.io X_OPERATIONAL_BAND: ci Loading input variables Updating Environment configuration to support Minikube WARNING: apt does not have a stable CLI interface. Use with caution in scripts. Get:1 file:/etc/apt/apt-mirrors.txt Mirrorlist [142 B] Hit:6 https://packages.microsoft.com/repos/azure-cli jammy InRelease Hit:2 http://azure.archive.ubuntu.com/ubuntu jammy InRelease Get:7 https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease [3632 B] Get:3 http://azure.archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB] Hit:4 http://azure.archive.ubuntu.com/ubuntu jammy-backports InRelease Get:5 http://azure.archive.ubuntu.com/ubuntu jammy-security InRelease [129 kB] Get:8 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main arm64 Packages [43.5 kB] Get:9 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 Packages [173 kB] Get:10 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main armhf Packages [15.6 kB] Get:11 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [2062 kB] Get:12 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [356 kB] Get:13 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main amd64 c-n-f Metadata [17.8 kB] Get:14 http://azure.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [2499 kB] Get:15 http://azure.archive.ubuntu.com/ubuntu jammy-updates/restricted Translation-en [430 kB] Get:16 http://azure.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1125 kB] Get:17 http://azure.archive.ubuntu.com/ubuntu jammy-updates/universe Translation-en [262 kB] Get:18 http://azure.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 c-n-f Metadata [26.1 kB] Get:19 http://azure.archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1844 kB] Get:20 http://azure.archive.ubuntu.com/ubuntu jammy-security/main Translation-en [298 kB] Get:21 http://azure.archive.ubuntu.com/ubuntu jammy-security/main amd64 c-n-f Metadata [13.3 kB] Get:22 http://azure.archive.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [2439 kB] Get:23 http://azure.archive.ubuntu.com/ubuntu jammy-security/restricted Translation-en [420 kB] Get:24 http://azure.archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [905 kB] Get:25 http://azure.archive.ubuntu.com/ubuntu jammy-security/universe Translation-en [177 kB] Get:26 http://azure.archive.ubuntu.com/ubuntu jammy-security/universe amd64 c-n-f Metadata [19.3 kB] Fetched 13.4 MB in 2s (6904 kB/s) Reading package lists... Building dependency tree... Reading state information... 50 packages can be upgraded. Run 'apt list --upgradable' to see them. Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: conntrack 0 upgraded, 1 newly installed, 0 to remove and 50 not upgraded. Need to get 33.5 kB of archives. After this operation, 104 kB of additional disk space will be used. Get:1 file:/etc/apt/apt-mirrors.txt Mirrorlist [142 B] Get:2 http://azure.archive.ubuntu.com/ubuntu jammy/main amd64 conntrack amd64 1:1.4.6-2build2 [33.5 kB] Fetched 33.5 kB in 0s (842 kB/s) Selecting previously unselected package conntrack. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 266920 files and directories currently installed.) Preparing to unpack .../conntrack_1%3a1.4.6-2build2_amd64.deb ... Unpacking conntrack (1:1.4.6-2build2) ... Setting up conntrack (1:1.4.6-2build2) ... Processing triggers for man-db (2.10.2-1) ... NEEDRESTART-VER: 3.5 NEEDRESTART-KCUR: 6.8.0-1014-azure NEEDRESTART-KEXP: 6.8.0-1014-azure NEEDRESTART-KSTA: 1 fs.protected_regular = 0 Waiting for Docker to be ready 26.1.3 - 26.1.3 Docker daemon is ready Downloading Minikube v1.34.0 Downloading from: https://github.com/kubernetes/minikube/releases/download/v1.34.0/minikube-linux-amd64 Installing Minikube * minikube v1.34.0 on Ubuntu 22.04 - MINIKUBE_HOME=/home/runner/work/_temp * Using the docker driver based on user configuration * Using Docker driver with root privileges * Starting "minikube" primary control-plane node in "minikube" cluster * Pulling base image v0.0.45 ... * Downloading Kubernetes v1.30.5 preload ... * Creating docker container (CPUs=2, Memory=2048MB) ... * Preparing Kubernetes v1.30.5 on Docker 27.2.0 ... - Generating certificates and keys ... - Booting up control plane ... - Configuring RBAC rules ... * Configuring bridge CNI (Container Networking Interface) ... * Verifying Kubernetes components... - Using image docker.io/registry:2.8.3 - Using image gcr.io/k8s-minikube/kube-registry-proxy:0.0.6 - Using image gcr.io/k8s-minikube/storage-provisioner:v5 * Verifying registry addon... * Enabled addons: storage-provisioner, default-storageclass, registry * Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default > gcr.io/k8s-minikube/kicbase...: 0 B [_______________________] ?% ? p/s ? > gcr.io/k8s-minikube/kicbase...: 1.61 KiB / 487.90 MiB [>_] 0.00% ? p/s ? > gcr.io/k8s-minikube/kicbase...: 11.78 MiB / 487.90 MiB [>] 2.41% ? p/s ? > gcr.io/k8s-minikube/kicbase...: 49.25 MiB / 487.90 MiB 10.09% 82.12 MiB > gcr.io/k8s-minikube/kicbase...: 93.67 MiB / 487.90 MiB 19.20% 82.12 MiB > gcr.io/k8s-minikube/kicbase...: 134.78 MiB / 487.90 MiB 27.63% 82.12 Mi > gcr.io/k8s-minikube/kicbase...: 174.69 MiB / 487.90 MiB 35.80% 90.31 Mi > gcr.io/k8s-minikube/kicbase...: 217.33 MiB / 487.90 MiB 44.54% 90.31 Mi > gcr.io/k8s-minikube/kicbase...: 261.05 MiB / 487.90 MiB 53.50% 90.31 Mi > gcr.io/k8s-minikube/kicbase...: 303.56 MiB / 487.90 MiB 62.22% 98.34 Mi > gcr.io/k8s-minikube/kicbase...: 340.14 MiB / 487.90 MiB 69.72% 98.34 Mi > gcr.io/k8s-minikube/kicbase...: 386.30 MiB / 487.90 MiB 79.18% 98.34 Mi > gcr.io/k8s-minikube/kicbase...: 431.71 MiB / 487.90 MiB 88.48% 105.7 Error: Command failed: sudo chown -R $USER $HOME/.kube /home/runner/work/_temp/.minikube Error: Command failed: sudo chown -R $USER $HOME/.kube /home/runner/work/_temp/.minikube at genericNodeError (node:internal/errors:984:15) at wrappedFn (node:internal/errors:538:14) at checkExecSyncError (node:child_process:890:11) at Object.execSync (node:child_process:962:15) at logExecSync (/home/runner/work/_actions/manusa/actions-setup-minikube/v2.11.0/src/exec.js:8:17) at install (/home/runner/work/_actions/manusa/actions-setup-minikube/v2.11.0/src/install.js:30:3) at async run (/home/runner/work/_actions/manusa/actions-setup-minikube/v2.11.0/src/index.js:16:3) { status: 1, signal: null, output: [ null, null, null ], pid: 6354, stdout: null, stderr: null } Error: Command failed: sudo chown -R $USER $HOME/.kube /home/runner/work/_temp/.minikube ```

Operating System

Ubuntu

Driver

Docker

spowelljr commented 1 month ago

Hi @mprimeaux, I looked into this, and this looks like the doing of the GitHub Action itself

https://github.com/manusa/actions-setup-minikube/blob/92af4db914ab207f837251cd53eb7060e6477614/src/install.js#L30

We don't maintain that GitHub Action so I'd suggest you open the issue under the action itself.

mprimeaux commented 1 month ago

Thanks, @spowelljr . I’ll open an issue and cross reference this one. Would you prefer me to close this issue?

mprimeaux commented 1 month ago

Fixed here.