Installing on Kubernetes / Openshift
Preparing the Kubernetes namespace
The deploy directory referenced below can be found here
-
Search for the Custom Resource Definition (CRD) and create it if it doesn’t already exist.
$ oc get crds | grep manageiqs.manageiq.org $ oc create -f deploy/crds/manageiq.org_manageiqs_crd.yaml
-
Set up RBAC.
$ oc create -f deploy/role.yaml $ oc create -f deploy/role_binding.yaml $ oc create -f deploy/service_account.yaml
-
Deploy the operator in your namespace.
$ oc create -f deploy/operator.yaml
Migrating from Appliances
Collect data from the appliance
-
Take a backup of the database
$ pg_dump -Fc -d vmdb_production > /root/pg_dump
-
Export the encryption key and Base64 encode it for the Kubernetes Secret.
$ vmdb && rails r "puts Base64.encode64(ManageIQ::Password.v2_key.to_s)"
-
Get the region number
$ vmdb && rails r "puts MiqRegion.my_region.region"
-
Get the GUID of the server that you want to run as.
$ vmdb && cat GUID
Restore the backup into the kubernetes environment
-
Create a YAML file defining the Custom Resource (CR). Minimally you’ll need the following:
apiVersion: manageiq.org/v1alpha1 kind: ManageIQ metadata: name: <friendly name for you CR instance> spec: applicationDomain: <your application domain name> databaseRegion: <region number from the appliance above> serverGuid: <GUID value from appliance above>
-
Create the CR in your namespace. Once created, the operator will create several additional resources and start deploying the app.
$ oc create -f <file name from above>
-
Edit the app secret inserting the encryption key from the appliance. Replace the “encryption-key” value with the value we exported from the appliance above.
$ oc edit secret app-secrets
-
Find the orchestrator pod and start a debug session into it. Keep this running in the background…
$ oc get pods -o name | grep orchestrator $ oc debug pod/orchestrator-123456abcd-789ef
-
Temporarily prevent the orchestrator from starting by adding the following to the deployment:
$ oc edit deployment/orchestrator spec: template: spec: nodeSelector: kubernetes.io/hostname: nope
-
Delete the old replica set, the new one will sit in “pending” state.
$ oc delete replicaset.apps/orchestrator-123456abcd
-
Back in the debug pod from step 4:
$ cd /var/www/miq/vmdb $ source ./container_env $ DISABLE_DATABASE_ENVIRONMENT_CHECK=1 rake db:drop db:create
-
oc rsh
into the database pod and restore the database backup$ cd /var/lib/pgsql # --- download your backup here --- $ pg_restore -d vmdb_production <your_backup_file> $ rm -f <your_backup_file> $ exit
-
Back in the debug pod from step 4:
$ rake db:migrate $ exit
-
Delete the node selector that we added above
oc edit deployment/orchestrator
removing:spec: template: spec: nodeSelector:
-
Delete the pending orchestrator deployment
$ oc delete replicaset.apps/orchestrator-98765cba
Done! The orchestrator will start deploying the rest of the pods required to run the application.