Skip to content

tosin2013/bare-metal-assisted-installer

Repository files navigation

Deploy Bare-Metal Clusters via Hive and Assisted Installer

The below instructions shows how to deploy a single node bare metal Openshift Cluster. Native OpenShift or CRC may be used when running the instuctions below.

Requirements

  • kustomize
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"  | bash
sudo mv kustomize /usr/local/bin 
  • OpenShift CLI
curl -OL https://raw.githubusercontent.com/tosin2013/openshift-4-deployment-notes/master/pre-steps/configure-openshift-packages.sh
chmod +x configure-openshift-packages.sh
./configure-openshift-packages.sh -i
  • OpenShift or CRC

Directions

git clone https://github.com/tosin2013/bare-metal-assisted-installer.git

cd into directory

cd bare-metal-assisted-installer

Generate sshkey for clusters

ssh-keygen

Create Deployment folder

Once the deployment has been complete you can check in the code into git.

./scripts/create-cluster-deployment.sh

export Deployment name

$ source $HOME/env.variables 

$ echo  echo $CLUSTER_DEPLOYMENT
baremetal-testing

Deploy Operators

kustomize build  ${CLUSTER_DEPLOYMENT}/01-operators | oc create -f - 

Wait fo operators to load

 ./scripts/operator-status.sh

Collect the latset OpenShift version information for target cluster

$ ./scripts/get-openshift-versions.sh

Edit scripts and update config

edit and run scripts/cluster-imageset.sh

  • You can find release versions here
  • You may also check the lastest stable release infomration here

If you want to target a specific release manually update the variables in the script.

$ vi scripts/cluster-imageset.sh
export OPENSHIFT_META_TAG="openshift-v4.8.4"
export OPENSHIFT_VERSION="4.8.4"

If you want to deploy the latest version of Openshift using the get-openshift-version.sh run the script below.

$ ./scripts/cluster-imageset.sh

edit and run scripts/coreos-imageupdate.sh

If you want to target a specific release manually update the variables in the script.

$ vi ./scripts/coreos-imageupdate.sh
export OPENSHIFT_VERSION="4.8.4"
export OPENSHIFT_VERSION_TAG="4.8"
export RHCOS_VERSION=48.84.202107301701-0

If you want to deploy the latest version of Openshift using the get-openshift-version.sh run the script below.

$ ./scripts/coreos-imageupdate.sh

edit and run scripts/set-cluster-pullsecret.sh

https://cloud.redhat.com/openshift/install/metal/user-provisioned

vim $HOME/pullsecert.txt
./scripts/set-cluster-pullsecret.sh

validate kustomize results

kustomize build  ${CLUSTER_DEPLOYMENT}/02-config

Apply kustomize

kustomize build  ${CLUSTER_DEPLOYMENT}/02-config | oc create -f - 

Configure deployment

edit and run scripts/clusteragent-settings.sh

If you want to target a specific release manually or change the default ssh key used update the variables in the script.

$ vi scripts/clusteragent-settings.sh
export OPENSHIFT_META_TAG="openshift-v4.8.3"

If you want to deploy the latest version of Openshift using the get-openshift-version.sh run the script below.

./scripts/clusteragent-settings.sh

run scripts/clusterdeployment-settings.sh

$ ./scripts/clusterdeployment-settings.sh

run scripts/infraenv-settings.sh

$ ./scripts/infraenv-settings.sh

validate kustomize results

kustomize build  ${CLUSTER_DEPLOYMENT}/03-deployment

Apply kustomize

kustomize build  ${CLUSTER_DEPLOYMENT}/03-deployment | oc create -f - 

Wait for assisted-service pod

./scripts/assisted-service-status.sh

Provision baremetal node

Get download URL

source $HOME/env.variables 
oc get infraenv ${CLUSTER_DEPLOYMENT}-infraenv -o jsonpath='{.status.isoDownloadURL}' -n assisted-installer

Download iso

source $HOME/env.variables 
DOWNLOAD_URL=$(oc get infraenv $CLUSTER_DEPLOYMENT-infraenv -o jsonpath='{.status.isoDownloadURL}' -n assisted-installer)

cat >isodownloader.sh<<YAML
#!/bin/bash
curl -k -L "$DOWNLOAD_URL" -o ai-install.iso
YAML

Load iso on baremetal cluster

For pxe deployments

  • install memdisk
  • add the below to your pxefile

            LABEL signaliso
                MENU LABEL ^signaliso Install 4.8
                root (hd0,0)
                kernel ::boot/amd64/memdisk/memdisk
                append iso initrd=::boot/amd64/ai-install/1/ai-install.iso raw
            MENU END

Once iso is loaded on cluster access the boot config with the command below Press tab to edit boot config

Use the command below to assign name to server on boot

ip=::::edge1.baremetal-testing.example.com:eno1:dhcp nameserver=192.168.1.2 

the baremetal-testing is the custer name in this example

Once machine has booted get collect agent info

source $HOME/env.variables 
oc get agentclusterinstalls $CLUSTER_DEPLOYMENT-aci -o json -n assisted-installer | jq '.status.conditions[]'

Get status of machine once machine has started
This will return blank until the cluster has registred

oc get agents.agent-install.openshift.io -n assisted-installer  -o=jsonpath='{range .items[*]}{"\n"}{.spec.clusterDeploymentName.name}{"\n"}{.status.inventory.hostname}{"\n"}{range .status.conditions[*]}{.type}{"\t"}{.message}{"\n"}{end}'

Check for the clusterid

oc get agents.agent-install.openshift.io -n assisted-installer

Approve cluster

source $HOME/env.variables 
CLUSTER_ID=$(oc get agents.agent-install.openshift.io -n assisted-installer | grep ${CLUSTER_DEPLOYMENT} | awk '{print $1}')
oc -n assisted-installer patch agents.agent-install.openshift.io $CLUSTER_ID -p '{"spec":{"approved":true}}' --type merge

Monitor installation
You can also ssh into device using core username and the ssh key you created

$ oc get agents.agent-install.openshift.io -n assisted-installer
or
$ oc get agents.agent-install.openshift.io -n assisted-installer  -o=jsonpath='{range .items[*]}{"\n"}{.spec.clusterDeploymentName.name}{"\n"}{.status.inventory.hostname}{"\n"}{range .status.conditions[*]}{.type}{"\t"}{.message}{"\n"}{end}'
or 
$ source $HOME/env.variables 
$ oc get agentclusterinstalls $CLUSTER_DEPLOYMENT-aci -o json -n assisted-installer | jq '.status.conditions[]'

Update DNS settings to access instance

api.baremetal-testing IN A 192.168.1.19
*.apps.baremetal-testing IN A 192.168.1.19
edge1.baremetal-testing      IN A 192.168.1.19

Access you OpenShift instance

$ source $HOME/env.variables 

$ mkdir -p ${HOME}/${CLUSTER_DEPLOYMENT}/auth

$ oc get secret -n assisted-installer $CLUSTER_DEPLOYMENT-admin-kubeconfig -o json | jq -r '.data.kubeconfig' | base64 -d > ${HOME}/${CLUSTER_DEPLOYMENT}/auth/$CLUSTER_DEPLOYMENT-admin-kubeconfig

$ oc get secret -n assisted-installer $CLUSTER_DEPLOYMENT-admin-password -o json | jq -r '.data.password' | base64 -d > ${HOME}/${CLUSTER_DEPLOYMENT}/auth/$CLUSTER_DEPLOYMENT-admin-password

$ export KUBECONFIG=${HOME}/${CLUSTER_DEPLOYMENT}/auth/$CLUSTER_DEPLOYMENT-admin-kubeconfig 

$ oc get co

$ oc whoami --show-console

POST Steps

Move env.variables to cluster directory

mv $HOME/env.variables ${CLUSTER_DEPLOYMENT}

Optional push code configration to git

Add the following to the git ignore file

  • ${CLUSTER_DEPLOYMENT}/02-config/03-assisted-installer-secrets.yaml

Troubleshooting

  • if a Device fails to deploy run the following to recreate an iso
$ kustomize build  ${CLUSTER_DEPLOYMENT}/03-deployment | oc delete -f - 
$ sleep 60s
$ kustomize build  ${CLUSTER_DEPLOYMENT}/03-deployment | oc create -f - 
$ ./scripts/assisted-service-status.sh
  • To remove assisted installer from OpenShift and the configration run the wipe-cluster script
$ ./scripts/wipe-cluster.sh

Links:

About

Deploy a bare-metal OpenShift 4.x cluster using the assisted-installer

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages