SpectroCloud/RaspberryPiEdge

From DER's LLC
Jump to navigation Jump to search

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 Desktop 24.04.1 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-rke2 -> <k8s_version>
# Location: RETOOL -> Palette Release -> Vertex Info -> Airgap Binaries -> edge-native-byoi

##############################################
## TRUST DERS CA CERTS (Specific to my Lab) ##
##############################################
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=spectro-images
export OCI_PACK_REGISTRY=harbor.dersllc.com
export OCI_PACK_BASE=spectro-packs
export AGENT_VERSION="v4.5.14"

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

bash /nfs/Download/airgap-vertex-pack-edge-k8s-1.29.12.bin
bash /nfs/Download/airgap-vertex-pack-edge-k8s-1.31.4.bin
bash /nfs/Download/airgap-vertex-pack-edge-native-byoi-2.1.0.bin
bash /nfs/Download/airgap-vertex-pack-edge-rke2-1.31.4.bin

###########################
# Sync the Repo in Vertex #
###########################
# Navigate to: https://ders-vertex.dersllc.com/system
# Administration -> Pack Registries -> DERS-Harbor -> sync

################################################
# Pull the arm64 agent and push to Airgap Repo #
################################################
docker pull 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 $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

#############################
# Install Required Software #
#############################
#sudo snap install docker
sudo snap install curl
sudo apt-get install jq zstd rsync conntrack -y

##############################################################
# Export the Palette Stylus ARM Agent Container (Air-Gapped) #
##############################################################
# 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:$EDGE_API_VERSION
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 #
##################################
export URL=https://github.com/spectrocloud/agent-mode/releases/download/v4.5.5/palette-agent-linux-arm64
curl --verbose --location $URL --output palette-agent

#####################
# Install the Agent #
#####################
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-$EDGE_API_VERSION.tar  --config "./user-data" --local
./palette-agent install --source $OCI_IMAGE_REGISTRY/$OCI_IMAGE_BASE/us-docker.pkg.dev/palette-images-fips/edge/stylus-agent-mode-linux-arm64:$AGENT_VERSION  --config "./user-data"

Create Cluster on Edge Node

###########################
# Create New Edge Profile #
###########################
# Name: EDGE BASE
# Version: 1.0.0
# Type: Infrastructure
##
# Cloud Type: Edge Native
##
# OS Layer: BYOS Edge OS
# - Values: ADD STYLUSPACKAGE AND SET system.uri to NA
#    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"
# K8s Layer: Palette eXtended Kubernetes Edge
# - Version: 1.31.4
# - Values: 
#     Change:
        imageRepository: harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/k8s 
# 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 the Edge Node #
###################################
# Navigate to: Clusters -> Create Cluster
##
# Cluster Type: Edge Native
##
# Name: edge-pi
##
# Add Profile: EDGE BASE
##
# 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
# worker-pool configuration
# DELETE
##
# FINISH CONFIGURATION

Appendix

Troubleshooting

ERROR: system image is not defined cannot apply upgrade"

export IMG_HOST_ENDPOINT="us-docker.pkg.dev/palette-images/edge"
export STYLUS_IMG_ENDPOINT="harbor.dersllc.com/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.ders-vertex.dersllc.com/v1/auth/syslogin | jq -r '.Authorization'`
#echo $AUTH_TOKEN
echo "curl --insecure -X GET -H 'Authorization: $AUTH_TOKEN'  https://api.ders-vertex.dersllc.com/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.ders-vertex.dersllc.com/v1/system/config/edgeNative/image" | bash -


docker pull us-docker.pkg.dev/palette-images/edge/stylus-framework-linux-arm64:v4.5.14 --platform linux/arm64
docker tag us-docker.pkg.dev/palette-images/edge/stylus-framework-linux-arm64:v4.5.14 harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-framework-linux-arm64:v4.5.14
docker push harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-framework-linux-arm64:v4.5.14

docker pull us-docker.pkg.dev/palette-images/edge/stylus-linux-arm64:v4.5.14 --platform linux/arm64
docker tag us-docker.pkg.dev/palette-images/edge/stylus-linux-arm64:v4.5.14 harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-linux-arm64:v4.5.14
docker push harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-linux-arm64:v4.5.14

docker pull us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:v4.5.14 --platform linux/arm64
docker tag us-docker.pkg.dev/palette-images/edge/stylus-agent-mode-linux-arm64:v4.5.14 harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-agent-mode-linux-arm64:v4.5.14
docker push harbor.dersllc.com/spectro-images/us-docker.pkg.dev/palette-images-fips/edge/stylus-agent-mode-linux-arm64:v4.5.14



Set Static IP Address (NOT WORKING)

# SSH to the Raspberry Pi or use the console.
# Set Static IP Address by running the following:
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