Skip to content

Commit 0428414

Browse files
Copilotabdurriq
andauthored
Fix kubectl-helm-minikube installation failures on debian:11 and ubuntu:focal (#1567)
* Initial plan * Fix kubectl SHA256 download URL and bump version to 1.3.1 Co-authored-by: abdurriq <[email protected]> * Add timeout and fallback for kubectl version fetching Co-authored-by: abdurriq <[email protected]> * Improve error messages and diagnostics for kubectl version fetching Co-authored-by: abdurriq <[email protected]> * Address code review feedback: clean up error handling Co-authored-by: abdurriq <[email protected]> * Improve error message to reference VERSION option Co-authored-by: abdurriq <[email protected]> * Use hardcoded fallback version instead of git tags fallback Co-authored-by: abdurriq <[email protected]> * Add version validation and comment for fallback version Co-authored-by: abdurriq <[email protected]> * Extract fallback version to constant at top of file Co-authored-by: abdurriq <[email protected]> * Update fallback version of kubectl to v1.35.1 * Add alternative URL fallback before using hardcoded version Co-authored-by: abdurriq <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: abdurriq <[email protected]> Co-authored-by: Abdurrahmaan Iqbal <[email protected]>
1 parent dc5ef27 commit 0428414

2 files changed

Lines changed: 70 additions & 59 deletions

File tree

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
11
{
2-
"id": "kubectl-helm-minikube",
3-
"version": "1.3.0",
4-
"name": "Kubectl, Helm, and Minikube",
5-
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube",
6-
"description": "Installs latest version of kubectl, Helm, and optionally minikube. Auto-detects latest versions and installs needed dependencies.",
7-
"options": {
8-
"version": {
9-
"type": "string",
10-
"proposals": [
11-
"latest",
12-
"none",
13-
"1.23",
14-
"1.22",
15-
"1.21",
16-
"none"
17-
],
18-
"default": "latest",
19-
"description": "Select or enter a Kubernetes version to install"
20-
},
21-
"helm": {
22-
"type": "string",
23-
"proposals": [
24-
"latest",
25-
"none"
26-
],
27-
"default": "latest",
28-
"description": "Select or enter a Helm version to install"
29-
},
30-
"minikube": {
31-
"type": "string",
32-
"proposals": [
33-
"latest",
34-
"none"
35-
],
36-
"default": "latest",
37-
"description": "Select or enter a Minikube version to install"
38-
}
2+
"id": "kubectl-helm-minikube",
3+
"version": "1.3.1",
4+
"name": "Kubectl, Helm, and Minikube",
5+
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube",
6+
"description": "Installs latest version of kubectl, Helm, and optionally minikube. Auto-detects latest versions and installs needed dependencies.",
7+
"options": {
8+
"version": {
9+
"type": "string",
10+
"proposals": [
11+
"latest",
12+
"none",
13+
"1.23",
14+
"1.22",
15+
"1.21",
16+
"none"
17+
],
18+
"default": "latest",
19+
"description": "Select or enter a Kubernetes version to install"
3920
},
40-
"mounts": [
41-
{
42-
"source": "minikube-config",
43-
"target": "/home/vscode/.minikube",
44-
"type": "volume"
45-
}
46-
],
47-
"customizations": {
48-
"vscode": {
49-
"settings": {
50-
"github.copilot.chat.codeGeneration.instructions": [
51-
{
52-
"text": "This dev container includes kubectl, Helm, optionally minikube, and needed dependencies pre-installed and available on the `PATH`. When configuring Ingress for your Kubernetes cluster, note that by default Kubernetes will bind to a specific interface's IP rather than localhost or all interfaces. This is why you need to use the Kubernetes Node's IP when connecting - even if there's only one Node as in the case of Minikube."
53-
}
54-
]
55-
}
56-
}
21+
"helm": {
22+
"type": "string",
23+
"proposals": [
24+
"latest",
25+
"none"
26+
],
27+
"default": "latest",
28+
"description": "Select or enter a Helm version to install"
5729
},
58-
"installsAfter": [
59-
"ghcr.io/devcontainers/features/common-utils"
60-
]
30+
"minikube": {
31+
"type": "string",
32+
"proposals": [
33+
"latest",
34+
"none"
35+
],
36+
"default": "latest",
37+
"description": "Select or enter a Minikube version to install"
38+
}
39+
},
40+
"mounts": [
41+
{
42+
"source": "minikube-config",
43+
"target": "/home/vscode/.minikube",
44+
"type": "volume"
45+
}
46+
],
47+
"customizations": {
48+
"vscode": {
49+
"settings": {
50+
"github.copilot.chat.codeGeneration.instructions": [
51+
{
52+
"text": "This dev container includes kubectl, Helm, optionally minikube, and needed dependencies pre-installed and available on the `PATH`. When configuring Ingress for your Kubernetes cluster, note that by default Kubernetes will bind to a specific interface's IP rather than localhost or all interfaces. This is why you need to use the Kubernetes Node's IP when connecting - even if there's only one Node as in the case of Minikube."
53+
}
54+
]
55+
}
56+
}
57+
},
58+
"installsAfter": [
59+
"ghcr.io/devcontainers/features/common-utils"
60+
]
6161
}

src/kubectl-helm-minikube/install.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ set -e
1212
# Clean up
1313
rm -rf /var/lib/apt/lists/*
1414

15+
# Fallback version when stable.txt cannot be fetched (updated: 2026-02)
16+
KUBECTL_FALLBACK_VERSION="v1.35.1"
17+
1518
KUBECTL_VERSION="${VERSION:-"latest"}"
1619
HELM_VERSION="${HELM:-"latest"}"
1720
MINIKUBE_VERSION="${MINIKUBE:-"latest"}" # latest is also valid
@@ -154,7 +157,15 @@ if [ ${KUBECTL_VERSION} != "none" ]; then
154157
# Install the kubectl, verify checksum
155158
echo "Downloading kubectl..."
156159
if [ "${KUBECTL_VERSION}" = "latest" ] || [ "${KUBECTL_VERSION}" = "lts" ] || [ "${KUBECTL_VERSION}" = "current" ] || [ "${KUBECTL_VERSION}" = "stable" ]; then
157-
KUBECTL_VERSION="$(curl -sSL https://dl.k8s.io/release/stable.txt)"
160+
KUBECTL_VERSION="$(curl -fsSL --connect-timeout 10 --max-time 30 https://dl.k8s.io/release/stable.txt 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' || echo "")"
161+
if [ -z "${KUBECTL_VERSION}" ]; then
162+
echo "(!) Failed to fetch kubectl stable version from dl.k8s.io, trying alternative URL..."
163+
KUBECTL_VERSION="$(curl -fsSL --connect-timeout 10 --max-time 30 https://storage.googleapis.com/kubernetes-release/release/stable.txt 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' || echo "")"
164+
fi
165+
if [ -z "${KUBECTL_VERSION}" ]; then
166+
echo "(!) Failed to fetch kubectl stable version from both URLs. Using fallback version ${KUBECTL_FALLBACK_VERSION}"
167+
KUBECTL_VERSION="${KUBECTL_FALLBACK_VERSION}"
168+
fi
158169
else
159170
find_version_from_git_tags KUBECTL_VERSION https://github.com/kubernetes/kubernetes
160171
fi
@@ -164,7 +175,7 @@ if [ ${KUBECTL_VERSION} != "none" ]; then
164175
curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl"
165176
chmod 0755 /usr/local/bin/kubectl
166177
if [ "$KUBECTL_SHA256" = "automatic" ]; then
167-
KUBECTL_SHA256="$(curl -sSL "https://dl.k8s.io/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl.sha256")"
178+
KUBECTL_SHA256="$(curl -sSL "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl.sha256")"
168179
fi
169180
([ "${KUBECTL_SHA256}" = "dev-mode" ] || (echo "${KUBECTL_SHA256} */usr/local/bin/kubectl" | sha256sum -c -))
170181
if ! type kubectl > /dev/null 2>&1; then

0 commit comments

Comments
 (0)