SpectroCloud/RaspberryPiEdge: Difference between revisions

From DER's LLC
Jump to navigation Jump to search
 
(80 intermediate revisions by the same user not shown)
Line 6: Line 6:
  ############################################################
  ############################################################
  # Raspberry Pi Device: RASPBERRY PI 5
  # Raspberry Pi Device: RASPBERRY PI 5
  # Operating System:    Ubuntu Desktop 24.04.1 LTS (64-BIT)
  # Operating System:    Ubuntu Server 24.04.2 LTS (64-BIT)
  # Storage:            Internal SD CARD READER
  # Storage:            Internal SD CARD READER
  ############################################################
  ############################################################


  # Finish the Setup Wizard
  # Finish the Setup Wizard
# Modify Settings before completion
# -  Complete the Hostname
# -  Add a user and pass
# -  Enable SSH with password auth
== Prepare Environment ==
##########################
# Download Edge Binaries #
##########################
# Location: RETOOL -> Palette Release -> Vertex Info -> Airgap Binaries -> edge-k3s -> <k8s_version>
# Location: RETOOL -> Airgap Binaries -> edge-native-byoi (latest)
#############################
## TRUST HomeLab CA CERTS  ##
#############################
curl --insecure https://ders-gitlab.dersllc.com/ders/ders-proxy/-/raw/master/AddTrustExternalCARoot.crt > /usr/local/share/ca-certificates/ders-star-ca.crt
curl --insecure https://ders-gitlab.dersllc.com/ders/vmware-se/-/raw/main/HomeLab/DERS-CA-CERT/ders-ca.cer > /usr/local/share/ca-certificates/ders-ssca.crt
update-ca-certificates
   
   
  # Enable SSH
  ###########################################
  sudo apt update
  # Upload the Binaries into AirGapped Repo #
  sudo apt install ssh
  ###########################################
  sudo ufw allow 22
  # SET VARIABLES
  sudo systemctl enable ssh
  export OCI_IMAGE_REGISTRY=harbor.dersllc.com
sudo systemctl start ssh
  export OCI_IMAGE_BASE=airgap-spectro-images
 
  export OCI_PACK_REGISTRY=harbor.dersllc.com
== Set Static IP Address (NOT WORKING)==
export OCI_PACK_BASE=airgap-spectro-packs
# SSH to the Raspberry Pi or use the console.
export K8S_VERSION="1.32.1"
  # Set Static IP Address by running the following:
  export AGENT_VERSION="v4.6.12"
cat > /etc/netplan/50-cloud-init.yaml << "EOF"
  network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses:
      - 172.16.84.33/22
      nameservers:
        addresses:
        - 172.16.84.10
        search:
          - dersllc.com
      routes:
      -   to: default
          via: 172.16.84.1
  EOF
   
   
netplan apply
== Install Palette Agent ==
  #############################
  #############################
  # Install Required Software #
  # Install Required Software #
  #############################
  #############################
sudo snap install docker
  sudo apt-get install jq zstd rsync conntrack docker.io -y
sudo snap install curl
snap install oras --classic
  sudo apt-get install jq zstd rsync conntrack -y
   
   
oras login $OCI_IMAGE_REGISTRY --username 'admin' --password '<Password>'
docker login $OCI_IMAGE_REGISTRY -u admin -p '<Password>'
bash /nfs/Download/airgap-pack-edge-k3s-$K8S_VERSION.bin --target ./trash
export IMAGES=`cat ./trash/docker/images.lst | cut -d ',' -f 2`
for i in $IMAGES; \
do  \
  docker pull --platform arm64 $i; \
  docker tag $i $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/$i; \
  docker push --platform arm64 $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/$i; \
done
rm -rf ./trash
bash /nfs/Download/airgap-vertex-pack-edge-native-byoi-2.1.0.bin
###########################
# Sync the Repo in Vertex #
###########################
# Navigate to: https://paas.dersllc.com/admin/settings/registries/oci
# DER's Spectro-Packs -> sync
################################################
# Pull the arm64 agent and push to Airgap Repo #
################################################
docker pull --platform arm64 us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION
docker tag us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION
docker push --platform arm64 $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION
###############################
# Enable Pause Agent Upgrades #
###############################
# Navigate to: edge-pi Project -> Project Settings -> Platform -> Platform Settings -> Pause Agent Upgrades
== Install Palette Agent ==
  ##############################################################
  ##############################################################
  # Export the Palette Stylus ARM Agent Container (Air-Gapped) #
  # Export the Palette Stylus ARM Agent Container (Air-Gapped) #
  ##############################################################
  ##############################################################
  # Note: The version needed can be found in RETOOL (Palette Release -> Vertex Info -> Components -> stylus)
  # Note: The version needed can be found in RETOOL (Palette Release -> Vertex Info -> Components -> stylus)
export EDGE_API_VERSION='v4.5.14'
  docker pull  us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:v$AGENT_VERSION
  docker pull  us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$EDGE_API_VERSION
  docker save us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:v$AGENT_VERSION > arm-agent-$AGENT_VERSION.tar
  docker save us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$EDGE_API_VERSION > arm-agent-$EDGE_API_VERSION.tar
   
   
  ##################################
  ##################################
  # Download the palette-agent CLI #
  # Download the palette-agent CLI #
  ##################################
  ##################################
  export URL=https://github.com/spectrocloud/agent-mode/releases/download/v4.5.5/palette-agent-linux-arm64
  export URL=https://github.com/spectrocloud/agent-mode/releases/download/v$AGENT_VERSION/palette-agent-linux-arm64
  curl --verbose --location $URL --output palette-agent
  curl --verbose --location $URL --output palette-agent
   
  chmod +x palette-agent
#########################
## TRUST DERS CA CERTS ##
#########################
sudo curl --insecure https://ders-gitlab.dersllc.com/ders/ders-proxy/-/raw/master/AddTrustExternalCARoot.crt > /usr/local/share/ca-certificates/ders-star-ca.crt
sudo curl --insecure https://ders-gitlab.dersllc.com/ders/vmware-se/-/raw/main/HomeLab/DERS-CA-CERT/ders-ca.cer > /usr/local/share/ca-certificates/ders-ssca.crt
sudo update-ca-certificates
   
   
  #####################
  #####################
Line 76: Line 100:
  #####################
  #####################
  curl --insecure https://ders-gitlab.dersllc.com/ders/spectro-sa/-/raw/main/edge/user-data.yaml > user-data
  curl --insecure https://ders-gitlab.dersllc.com/ders/spectro-sa/-/raw/main/edge/user-data.yaml > user-data
  chmod +x palette-agent
  #./palette-agent install --source ./arm-agent-$AGENT_VERSION.tar  --config "./user-data" --local
  ./palette-agent install --source ./arm-agent-$EDGE_API_VERSION.tar --config "./user-data" --local
  ./palette-agent install --source $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION --config "./user-data"
 
== Create a Cluster Profile for the Edge Node ==
###########################
# Create New Edge Profile #
###########################
# Name: EDGE BASE RKE2
# Version: 1.31.4
# Type: Infrastructure
##
# Cloud Type: Edge Native
##
# OS Layer: BYOS Edge OS
# - Check the Preset radio button for edge
# - Values:
#  Add the following to the yaml
#    stylusPackage: harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:v4.5.14
#    options:
#      system.uri: "NA"
# Add the following:
# K8s Layer: Palette Optimized RKE2
# - Version: 1.31.4
# - Values:
#  Modify all occurrences of docker.io with harbor.dersllc.com/spectro-images/docker.io
# Network Layer: Calico
# - Values:
#  Modify all occurrences of us-docker.pkg.dev with harbor.dersllc.com/spectro-images/us-docker.pkg.dev
 
== Create Cluster on Edge Node ==
###################################
# Create Cluster on the Edge Node #
###################################
# Navigate to: Clusters -> Create Cluster
##
# Cluster Type: Edge Native
##
# Name: edge-pi
##
# Add Profile: EDGE BASE RKE2
##
# SSH Keys: opsman
# NTP Server: 172.16.84.21
# VIP: 172.16.84.35
##
# control-plane-pool configuration
# - Allow worker capability (Optional): TRUE
# - Architecture: arm64
# - Edge Hosts: edge-pi
# DELETE worker-pool configuration
##
# FINISH CONFIGURATION
 
== Appendix ==
===Troubleshooting===
Error:
time="2025-04-11T16:25:35Z" level=error msg="system image is not defined cannot apply upgrade" version=v4.6.12
Fix:
export VERTEX_ENDPOINT="paas.dersllc.com"
export IMG_HOST_ENDPOINT="us-docker.pkg.dev/palette-images/edge"
export STYLUS_IMG_ENDPOINT="harbor.dersllc.com/airgap-spectro-images/us-docker.pkg.dev/palette-images-fips/edge"
   
   
  systemctl start spectro-palette-agent-start.service
  export AUTH_TOKEN=`curl --insecure -X POST -H "Content-Type: application/json" -d '{"username":"admin","password":"{{highlight|<password>}}"}' https://api.$VERTEX_ENDPOINT/v1/auth/syslogin | jq -r '.Authorization'`
  systemctl status spectro-palette-agent-start.service
  #echo $AUTH_TOKEN
echo "curl --insecure -X GET -H 'Authorization: $AUTH_TOKEN'  https://api.$VERTEX_ENDPOINT/v1/system/config/edgeNative/image" | bash -
echo "curl --insecure -X PUT -H 'Authorization: $AUTH_TOKEN' -H 'Content-Type: application/json' -d '{\"spec\":{\"imagesHostEndpoint\":\"$IMG_HOST_ENDPOINT\",\"stylusImagesEndpoint\":\"$STYLUS_IMG_ENDPOINT\"}}' https://api.$VERTEX_ENDPOINT/v1/system/config/edgeNative/image" | bash -

Latest revision as of 16:38, 11 April 2025

Raspberry Pi Edge Install

Install OS

# Connnect Network, Keyboard, HDMI, and Power
# Boot to Network by pressing and holding SHIFT
############################################################
# Raspberry Pi Device: RASPBERRY PI 5
# Operating System:    Ubuntu Server 24.04.2 LTS (64-BIT)
# Storage:             Internal SD CARD READER
############################################################
# Finish the Setup Wizard
# Modify Settings before completion
# -  Complete the Hostname
# -  Add a user and pass
# -  Enable SSH with password auth

Prepare Environment

##########################
# Download Edge Binaries #
##########################
# Location: RETOOL -> Palette Release -> Vertex Info -> Airgap Binaries -> edge-k3s -> <k8s_version>
# Location: RETOOL -> Airgap Binaries -> edge-native-byoi (latest)

#############################
## TRUST HomeLab CA CERTS  ##
#############################
curl --insecure https://ders-gitlab.dersllc.com/ders/ders-proxy/-/raw/master/AddTrustExternalCARoot.crt > /usr/local/share/ca-certificates/ders-star-ca.crt
curl --insecure https://ders-gitlab.dersllc.com/ders/vmware-se/-/raw/main/HomeLab/DERS-CA-CERT/ders-ca.cer > /usr/local/share/ca-certificates/ders-ssca.crt
update-ca-certificates

###########################################
# Upload the Binaries into AirGapped Repo #
###########################################
# SET VARIABLES
export OCI_IMAGE_REGISTRY=harbor.dersllc.com
export OCI_IMAGE_BASE=airgap-spectro-images
export OCI_PACK_REGISTRY=harbor.dersllc.com
export OCI_PACK_BASE=airgap-spectro-packs
export K8S_VERSION="1.32.1"
export AGENT_VERSION="v4.6.12"

#############################
# Install Required Software #
#############################
sudo apt-get install jq zstd rsync conntrack docker.io -y
snap install oras --classic

oras login $OCI_IMAGE_REGISTRY --username 'admin' --password '<Password>'

docker login $OCI_IMAGE_REGISTRY -u admin -p '<Password>'

bash /nfs/Download/airgap-pack-edge-k3s-$K8S_VERSION.bin --target ./trash
export IMAGES=`cat ./trash/docker/images.lst | cut -d ',' -f 2`
for i in $IMAGES; \
do  \
  docker pull --platform arm64 $i; \
  docker tag $i $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/$i; \
  docker push --platform arm64 $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/$i; \
done
rm -rf ./trash
bash /nfs/Download/airgap-vertex-pack-edge-native-byoi-2.1.0.bin


###########################
# Sync the Repo in Vertex #
###########################
# Navigate to: https://paas.dersllc.com/admin/settings/registries/oci
# DER's Spectro-Packs -> sync

################################################
# Pull the arm64 agent and push to Airgap Repo #
################################################
docker pull --platform arm64 us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION
docker tag us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION
docker push --platform arm64 $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION

###############################
# Enable Pause Agent Upgrades #
###############################
# Navigate to: edge-pi Project -> Project Settings -> Platform -> Platform Settings -> Pause Agent Upgrades

Install Palette Agent

##############################################################
# Export the Palette Stylus ARM Agent Container (Air-Gapped) #
##############################################################
# Note: The version needed can be found in RETOOL (Palette Release -> Vertex Info -> Components -> stylus)
docker pull  us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:v$AGENT_VERSION
docker save us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:v$AGENT_VERSION > arm-agent-$AGENT_VERSION.tar

##################################
# Download the palette-agent CLI #
##################################
export URL=https://github.com/spectrocloud/agent-mode/releases/download/v$AGENT_VERSION/palette-agent-linux-arm64
curl --verbose --location $URL --output palette-agent
chmod +x palette-agent

#####################
# Install the Agent #
#####################
curl --insecure https://ders-gitlab.dersllc.com/ders/spectro-sa/-/raw/main/edge/user-data.yaml > user-data
#./palette-agent install --source ./arm-agent-$AGENT_VERSION.tar  --config "./user-data" --local
./palette-agent install --source $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION  --config "./user-data"

Create a Cluster Profile for the Edge Node

###########################
# Create New Edge Profile #
###########################
# Name: EDGE BASE RKE2
# Version: 1.31.4
# Type: Infrastructure
##
# Cloud Type: Edge Native
##
# OS Layer: BYOS Edge OS
# - Check the Preset radio button for edge
# - Values:
#   Add the following to the yaml
#     stylusPackage: harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:v4.5.14
#     options:
#       system.uri: "NA"
# Add the following: 
# K8s Layer: Palette Optimized RKE2
# - Version: 1.31.4
# - Values: 
#   Modify all occurrences of docker.io with harbor.dersllc.com/spectro-images/docker.io
# Network Layer: Calico
# - Values: 
#   Modify all occurrences of us-docker.pkg.dev with harbor.dersllc.com/spectro-images/us-docker.pkg.dev

Create Cluster on Edge Node

################################### 
# Create Cluster on the Edge Node #
###################################
# Navigate to: Clusters -> Create Cluster
##
# Cluster Type: Edge Native
##
# Name: edge-pi
##
# Add Profile: EDGE BASE RKE2
##
# SSH Keys: opsman
# NTP Server: 172.16.84.21
# VIP: 172.16.84.35
##
# control-plane-pool configuration
# - Allow worker capability (Optional): TRUE
# - Architecture: arm64
# - Edge Hosts: edge-pi
# DELETE worker-pool configuration
##
# FINISH CONFIGURATION

Appendix

Troubleshooting

Error:

time="2025-04-11T16:25:35Z" level=error msg="system image is not defined cannot apply upgrade" version=v4.6.12

Fix:

export VERTEX_ENDPOINT="paas.dersllc.com"
export IMG_HOST_ENDPOINT="us-docker.pkg.dev/palette-images/edge"
export STYLUS_IMG_ENDPOINT="harbor.dersllc.com/airgap-spectro-images/us-docker.pkg.dev/palette-images-fips/edge"

export AUTH_TOKEN=`curl --insecure -X POST -H "Content-Type: application/json" -d '{"username":"admin","password":"<password>"}' https://api.$VERTEX_ENDPOINT/v1/auth/syslogin | jq -r '.Authorization'`
#echo $AUTH_TOKEN
echo "curl --insecure -X GET -H 'Authorization: $AUTH_TOKEN'  https://api.$VERTEX_ENDPOINT/v1/system/config/edgeNative/image" | bash -
echo "curl --insecure -X PUT -H 'Authorization: $AUTH_TOKEN' -H 'Content-Type: application/json' -d '{\"spec\":{\"imagesHostEndpoint\":\"$IMG_HOST_ENDPOINT\",\"stylusImagesEndpoint\":\"$STYLUS_IMG_ENDPOINT\"}}' https://api.$VERTEX_ENDPOINT/v1/system/config/edgeNative/image" | bash -