From 3408f68586626565c16d7c7e6b620c6403c93da2 Mon Sep 17 00:00:00 2001 From: N Avinash kumar <52166272+avinash9381091854@users.noreply.github.com> Date: Thu, 13 Feb 2025 23:29:43 +0530 Subject: [PATCH 1/7] Update kops.sh --- kops.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kops.sh b/kops.sh index 55b015d2..c35efd70 100644 --- a/kops.sh +++ b/kops.sh @@ -11,8 +11,8 @@ chmod +x kops-linux-amd64 kubectl mv kubectl /usr/local/bin/kubectl mv kops-linux-amd64 /usr/local/bin/kops -aws s3api create-bucket --bucket cloudanddevopsbyraham0073456.k8s.local --region us-east-1 -aws s3api put-bucket-versioning --bucket cloudanddevopsbyraham0073456.k8s.local --region us-east-1 --versioning-configuration Status=Enabled -export KOPS_STATE_STORE=s3://cloudanddevopsbyraham0073456.k8s.local -kops create cluster --name rahams.k8s.local --zones us-east-1a --master-count=1 --master-size t2.medium --node-count=2 --node-size t2.medium +aws s3api create-bucket --bucket avinash912.k8s.local --region us-east-1 +aws s3api put-bucket-versioning --bucket avinash912.k8s.local --region us-east-1 --versioning-configuration Status=Enabled +export KOPS_STATE_STORE=s3://avinash912.k8s.local +kops create cluster --name rahams.k8s.local --zones us-east-1a --master-count=1 --master-size t2.medium --node-count=2 --node-size t2.micro kops update cluster --name rahams.k8s.local --yes --admin From 5c4103ef43daf442720e7f96d83120cf4236f935 Mon Sep 17 00:00:00 2001 From: N Avinash kumar <52166272+avinash9381091854@users.noreply.github.com> Date: Thu, 10 Apr 2025 18:41:35 +0530 Subject: [PATCH 2/7] Update kops.sh --- kops.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/kops.sh b/kops.sh index c35efd70..eb03be89 100644 --- a/kops.sh +++ b/kops.sh @@ -4,7 +4,6 @@ #! /bin/bash -aws configure curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" wget https://github.com/kubernetes/kops/releases/download/v1.25.0/kops-linux-amd64 chmod +x kops-linux-amd64 kubectl From 6c0f2cd5b9e5e696b4eff4a017d73560e6782563 Mon Sep 17 00:00:00 2001 From: N Avinash kumar <52166272+avinash9381091854@users.noreply.github.com> Date: Sun, 6 Jul 2025 19:47:21 +0530 Subject: [PATCH 3/7] Update kops.sh --- kops.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kops.sh b/kops.sh index eb03be89..903034cf 100644 --- a/kops.sh +++ b/kops.sh @@ -5,7 +5,7 @@ #! /bin/bash curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -wget https://github.com/kubernetes/kops/releases/download/v1.25.0/kops-linux-amd64 +wget https://github.com/kubernetes/kops/releases/download/v1.30.3/kops-linux-amd64 chmod +x kops-linux-amd64 kubectl mv kubectl /usr/local/bin/kubectl mv kops-linux-amd64 /usr/local/bin/kops From d5e85800374b58420b42b299fb4916e55041a9b9 Mon Sep 17 00:00:00 2001 From: N Avinash kumar <52166272+avinash9381091854@users.noreply.github.com> Date: Sun, 6 Jul 2025 20:01:46 +0530 Subject: [PATCH 4/7] Update kops.sh --- kops.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kops.sh b/kops.sh index 903034cf..ec68fb4b 100644 --- a/kops.sh +++ b/kops.sh @@ -5,7 +5,7 @@ #! /bin/bash curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -wget https://github.com/kubernetes/kops/releases/download/v1.30.3/kops-linux-amd64 +wget https://github.com/kubernetes/kops/releases/download/1.30.3/kops-linux-amd64 chmod +x kops-linux-amd64 kubectl mv kubectl /usr/local/bin/kubectl mv kops-linux-amd64 /usr/local/bin/kops From ea838506fc6bd4a05da9c73561fcb58069a183d5 Mon Sep 17 00:00:00 2001 From: N Avinash kumar <52166272+avinash9381091854@users.noreply.github.com> Date: Mon, 7 Jul 2025 22:26:01 +0530 Subject: [PATCH 5/7] Update kops.sh --- kops.sh | 92 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 75 insertions(+), 17 deletions(-) diff --git a/kops.sh b/kops.sh index ec68fb4b..d5987236 100644 --- a/kops.sh +++ b/kops.sh @@ -1,17 +1,75 @@ -#vim .bashrc -#export PATH=$PATH:/usr/local/bin/ -#source .bashrc - - -#! /bin/bash -curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" -wget https://github.com/kubernetes/kops/releases/download/1.30.3/kops-linux-amd64 -chmod +x kops-linux-amd64 kubectl -mv kubectl /usr/local/bin/kubectl -mv kops-linux-amd64 /usr/local/bin/kops - -aws s3api create-bucket --bucket avinash912.k8s.local --region us-east-1 -aws s3api put-bucket-versioning --bucket avinash912.k8s.local --region us-east-1 --versioning-configuration Status=Enabled -export KOPS_STATE_STORE=s3://avinash912.k8s.local -kops create cluster --name rahams.k8s.local --zones us-east-1a --master-count=1 --master-size t2.medium --node-count=2 --node-size t2.micro -kops update cluster --name rahams.k8s.local --yes --admin +#!/bin/bash +set -euo pipefail + +# Export path for local binaries if needed +export PATH=$PATH:/usr/local/bin + +# Download latest stable kubectl +echo "📦 Downloading latest stable kubectl..." +curl -LO "https://dl.k8s.io/release/$(curl -sSL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + +# Download correct version of kops +KOPS_VERSION="1.30.3" +echo "📦 Downloading kops version v${KOPS_VERSION}..." +curl -LO "https://github.com/kubernetes/kops/releases/download/v${KOPS_VERSION}/kops-linux-amd64" + +# Make both binaries executable +chmod +x kubectl kops-linux-amd64 + +# Move them into PATH +sudo mv kubectl /usr/local/bin/kubectl +sudo mv kops-linux-amd64 /usr/local/bin/kops + +# Check if files are valid executables +echo "🔍 Validating binaries..." +file /usr/local/bin/kubectl +file /usr/local/bin/kops + +# Check versions +echo "✅ kubectl version:" +kubectl version --client + +echo "✅ kops version:" +kops version + +# --- Configuration Section --- +BUCKET_NAME="avinash912.k8s.local" +REGION="ap-south-1" +CLUSTER_NAME="aviiinasshh.k8s.local" +ZONES="ap-south-1a" +MASTER_SIZE="t2.medium" +NODE_SIZE="t2.micro" + +# --- S3 State Store Setup --- +echo "🌐 Setting up S3 bucket for Kops state store..." +aws s3api create-bucket \ + --bucket "$BUCKET_NAME" \ + --region "$REGION" \ + --create-bucket-configuration LocationConstraint="$REGION" \ + || echo "⚠️ Bucket already exists or is globally unique." + +echo "🔁 Enabling versioning on the bucket..." +aws s3api put-bucket-versioning \ + --bucket "$BUCKET_NAME" \ + --versioning-configuration Status=Enabled + +# Export state store +export KOPS_STATE_STORE="s3://${BUCKET_NAME}" + +# --- Cluster Creation --- +echo "🚀 Creating Kubernetes cluster: $CLUSTER_NAME" +kops create cluster \ + --name "$CLUSTER_NAME" \ + --zones "$ZONES" \ + --master-count=1 \ + --master-size "$MASTER_SIZE" \ + --node-count=2 \ + --node-size "$NODE_SIZE" \ + --yes + +# Optional: Apply admin access +echo "🔐 Applying admin access..." +kops update cluster --name "$CLUSTER_NAME" --yes --admin + +echo "✅ Done! Cluster creation has been initiated." +echo "⏳ Use 'kops validate cluster --name $CLUSTER_NAME' in a few minutes to check its status." From 8277e09a4f91597d4944eff54674bff01aad8723 Mon Sep 17 00:00:00 2001 From: N Avinash kumar <52166272+avinash9381091854@users.noreply.github.com> Date: Sun, 13 Jul 2025 18:18:11 +0530 Subject: [PATCH 6/7] Update kops.sh --- kops.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kops.sh b/kops.sh index d5987236..d875b6b4 100644 --- a/kops.sh +++ b/kops.sh @@ -33,9 +33,9 @@ echo "✅ kops version:" kops version # --- Configuration Section --- -BUCKET_NAME="avinash912.k8s.local" +BUCKET_NAME="avinash454.k8s.local" REGION="ap-south-1" -CLUSTER_NAME="aviiinasshh.k8s.local" +CLUSTER_NAME="aviiinasshhhh.k8s.local" ZONES="ap-south-1a" MASTER_SIZE="t2.medium" NODE_SIZE="t2.micro" From b1ef5ec49f210b2a9e0f9d05284f3b706f7b2352 Mon Sep 17 00:00:00 2001 From: N Avinash kumar <52166272+avinash9381091854@users.noreply.github.com> Date: Sun, 27 Jul 2025 19:07:25 +0530 Subject: [PATCH 7/7] Update kops.sh --- kops.sh | 89 ++++++++++++++++++++++----------------------------------- 1 file changed, 34 insertions(+), 55 deletions(-) diff --git a/kops.sh b/kops.sh index d875b6b4..5bf06d2c 100644 --- a/kops.sh +++ b/kops.sh @@ -1,75 +1,54 @@ #!/bin/bash set -euo pipefail -# Export path for local binaries if needed -export PATH=$PATH:/usr/local/bin - -# Download latest stable kubectl -echo "📦 Downloading latest stable kubectl..." +# ===== Configuration ===== +BUCKET_NAME="avinash912-$(date +%s).k8s.local" # ensure globally unique +CLUSTER_NAME="rahams.k8s.local" +REGION="us-east-1" +ZONES="us-east-1a" + +# ===== Download kubectl ===== +echo "📦 Downloading kubectl..." curl -LO "https://dl.k8s.io/release/$(curl -sSL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" +chmod +x kubectl +sudo mv kubectl /usr/local/bin/ -# Download correct version of kops -KOPS_VERSION="1.30.3" -echo "📦 Downloading kops version v${KOPS_VERSION}..." -curl -LO "https://github.com/kubernetes/kops/releases/download/v${KOPS_VERSION}/kops-linux-amd64" - -# Make both binaries executable -chmod +x kubectl kops-linux-amd64 - -# Move them into PATH -sudo mv kubectl /usr/local/bin/kubectl +# ===== Download kops ===== +echo "📦 Downloading kops..." +curl -LO https://github.com/kubernetes/kops/releases/latest/download/kops-linux-amd64 +chmod +x kops-linux-amd64 sudo mv kops-linux-amd64 /usr/local/bin/kops -# Check if files are valid executables -echo "🔍 Validating binaries..." -file /usr/local/bin/kubectl -file /usr/local/bin/kops - -# Check versions -echo "✅ kubectl version:" +# ===== Verify installations ===== +echo "✅ Verifying installations..." kubectl version --client - -echo "✅ kops version:" kops version -# --- Configuration Section --- -BUCKET_NAME="avinash454.k8s.local" -REGION="ap-south-1" -CLUSTER_NAME="aviiinasshhhh.k8s.local" -ZONES="ap-south-1a" -MASTER_SIZE="t2.medium" -NODE_SIZE="t2.micro" - -# --- S3 State Store Setup --- -echo "🌐 Setting up S3 bucket for Kops state store..." -aws s3api create-bucket \ - --bucket "$BUCKET_NAME" \ - --region "$REGION" \ - --create-bucket-configuration LocationConstraint="$REGION" \ - || echo "⚠️ Bucket already exists or is globally unique." +# ===== Create S3 bucket for Kops ===== +echo "🪣 Creating S3 bucket: $BUCKET_NAME..." +aws s3api create-bucket --bucket "$BUCKET_NAME" --region "$REGION" -echo "🔁 Enabling versioning on the bucket..." -aws s3api put-bucket-versioning \ - --bucket "$BUCKET_NAME" \ +# ===== Enable versioning ===== +echo "🔄 Enabling versioning on bucket..." +aws s3api put-bucket-versioning --bucket "$BUCKET_NAME" \ --versioning-configuration Status=Enabled -# Export state store -export KOPS_STATE_STORE="s3://${BUCKET_NAME}" +# ===== Export state store environment variable ===== +export KOPS_STATE_STORE="s3://$BUCKET_NAME" +echo "📌 KOPS_STATE_STORE set to $KOPS_STATE_STORE" -# --- Cluster Creation --- -echo "🚀 Creating Kubernetes cluster: $CLUSTER_NAME" +# ===== Create Kubernetes cluster ===== +echo "🛠️ Creating Kubernetes cluster..." kops create cluster \ --name "$CLUSTER_NAME" \ --zones "$ZONES" \ - --master-count=1 \ - --master-size "$MASTER_SIZE" \ - --node-count=2 \ - --node-size "$NODE_SIZE" \ - --yes + --master-size t2.medium \ + --node-size t2.micro \ + --master-count 1 \ + --node-count 2 -# Optional: Apply admin access -echo "🔐 Applying admin access..." +# ===== Apply the changes ===== +echo "🚀 Deploying the cluster..." kops update cluster --name "$CLUSTER_NAME" --yes --admin -echo "✅ Done! Cluster creation has been initiated." -echo "⏳ Use 'kops validate cluster --name $CLUSTER_NAME' in a few minutes to check its status." +echo "✅ Cluster deployment initiated."