3. Create a shell script file at same location with kind-cluster.yml with the name setup.sh - Manual - Industrial Edge - Industrial Edge - Industrial Edge - Documentation of Industrial Edge APIs - CLI tools - Industrial Edge - References - APIs

Industrial Edge Platform Operation - APIs & References

Product
Industrial Edge
Edition
12/2024
Language
en-US (original)
#!/bin/bash

certkey=""
cert=""
kindversion='v0.14.0'
kubectlversion='v1.26.0'
helmversion='v3.9.2'
namespace="deviem"
while getopts k:c:h:r:t:n: flag; do
 case "$flag" in
  k)
   kindversion=${OPTARG};;
  c)
   kubectlversion=${OPTARG};;
  h)
   helmversion=${OPTARG};;
  r)
   certkey=${OPTARG};;
  t)
   cert=${OPTARG};;
  n)
   namespace=${OPTARG};;
 esac
done
echo "kindversion: $kindversion";
echo "kubectlversion: $kubectlversion";
echo "helmversion: $helmversion";
sudo chown -R $(whoami) /usr/local;
if  [ ! -f /usr/bin/curl ]; then
 sudo apt-get install -y curl
fi
curl -fsSL https://get.docker.com -o get-docker.sh
if [ ! -f /usr/bin/docker ]; then
 sudo sh ./get-docker.sh
 sudo groupadd docker || true
 sudo usermod -aG docker "$USER" || true
 sudo chown $USER /var/run/docker.sock || true
 newgrp docker <<EONG
 echo ""
EONG
fi
if [ ! -f /usr/bin/docker-compose ]; then
 sudo apt install -y docker-compose
fi
if [ ! -f /usr/local/bin/kind ]; then
 curl -LO https://go.dev/dl/go1.19.5.linux-amd64.tar.gz
 rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.5.linux-amd64.tar.gz
 export PATH=$PATH:/usr/local/go/bin
 go install sigs.k8s.io/kind@$kindversion
 mv $(go env GOPATH)/bin/kind /usr/local/bin/kind
fi

if [ ! -f /usr/local/bin/helm ]; then
 curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
 chmod 700 get_helm.sh
 bash +x ./get_helm.sh --version "$helmversion"
fi

if [ ! -f /usr/local/bin/kubectl ]; then
 curl -LO "https://dl.k8s.io/release/$kubectlversion/bin/linux/amd64/kubectl"
 sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
fi
kubectl cluster-info
if [ ! $? -eq 0 ]; then
 kind create cluster --config "./kind-cluster.yml"
fi
kubectl create namespace $namespace
kubectl -n $namespace create secret tls kongcert --key $certkey --cert $cert
kubectl -n default create secret tls defaultcert --key $certkey --cert $cert


After the above step is completed, execute the script using following command:

bash +x setup.sh -r "out/myCert.key" -t "out/myCert.crt" -n "deviem"

This script will setup all the necessary tools and set up the KIND cluster with a namespace for the IEM installation. Use the same namespace as in the IEM manifest file.

Required parameters:

  • r : path/to/cert.key
  • t : path/to/cert.crt

Optional parameters:

  • k : kindversion
  • c : kubectlversion
  • h : helmversion
  • n : namespace