### Install AI Optimizer for Z Operator (YAML/Shell) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=installing-ai-optimizer-z Applies the necessary cluster resources and installs the AI Optimizer for Z operator in the `ai-optimizer4z-operator-system` namespace. This includes creating a Namespace, CatalogSource, OperatorGroup, and Subscription. ```yaml oc apply -f - << EOF apiVersion: v1 kind: Namespace metadata: name: ai-optimizer4z-operator-system --- apiVersion: operators.coreos.com/v1alpha1 kind: CatalogSource metadata: name: ai-optimizer4z-operator-catalog-source namespace: ai-optimizer4z-operator-system spec: sourceType: grpc image: icr.io/cpopen/ibm-ai-optimizer4z-operator-catalog@sha256:313a3bba761fdabde101bccef600cf83fd9a35c1e076f2fce40d294c523af8e5 displayName: AIOptimizer4z-Operator-Catalog publisher: IBM --- apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: ai-optimizer4z-operator-group namespace: ai-optimizer4z-operator-system --- apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: ai-optimizer4z-operator namespace: ai-optimizer4z-operator-system spec: channel: alpha name: ai-optimizer4z-operator source: ai-optimizer4z-operator-catalog-source sourceNamespace: ai-optimizer4z-operator-system installPlanApproval: Automatic EOF ``` -------------------------------- ### Verify AI Optimizer for Z Installation Readiness (Shell) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=deploying-gen-ai-services This command verifies if the AI Optimizer for Z custom resource installation is ready. It queries the `ai-optimizer4zstacks` resource and checks the `InstallationReady` status condition. The expected output for a successful deployment is 'True'. ```bash oc get -n ai-optimizer4z ai-optimizer4zstacks.ai-optimizer4z.ibm.com ai-optimizer4zstack-sample \ -o json | jq -r '.status.conditions[] | select(.type=="InstallationReady") | .status' ``` -------------------------------- ### Log in to IBM Entitled Registry (Docker) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=installing-ai-optimizer-z This command logs into the IBM Entitled Registry using a provided entitlement key. It's used to verify the key's validity before proceeding with the installation. ```shell docker login cp.icr.io --username cp --password ``` -------------------------------- ### Get AI Optimizer for Z Operator Pods using oc get Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-collecting-logs-troubleshooting Retrieves a list of pods related to the AI Optimizer for Z operator in the 'ai-optimizer4z-operator-system' namespace. This is necessary to find the operator catalog and controller pod names. ```shell oc get pods -n ai-optimizer4z-operator-system ``` -------------------------------- ### Configure createRoute in BYOSearch Spec Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-resolving-known-issues Example snippet showing how to set the 'createRoute' option to 'true' within the 'wrapper' specification of a BYOSearch resource. ```yaml spec: [...] wrapper: createRoute: true [...] [...] ``` -------------------------------- ### Retrieve AI Optimizer for Z UI Route Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=dgas-accessing-ai-optimizer-z-deployed-gen-ai-services This command retrieves the route information for the AI Optimizer for Z UI, which is installed in the 'ai-optimizer4z' namespace. The output of this command provides the full address required to access the UI in your web browser. ```bash oc get route -n ai-optimizer4z ``` -------------------------------- ### Get AI Optimizer for Z Service Pods using oc get Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-collecting-logs-troubleshooting Retrieves a list of pods associated with the AI Optimizer for Z REST API and UI services within the 'ai-optimizer4z' namespace. This helps identify pod names for subsequent log retrieval. ```shell oc get pods -n ai-optimizer4z ``` -------------------------------- ### Deploy watsonx Assistant for Z and watsonx Code Assistant for Z on x86 Systems (YAML) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=deploying-gen-ai-services This configuration deploys both watsonx Assistant for Z and watsonx Code Assistant for Z to an OCP cluster on an x86 system. It requires specifying namespaces, BYOS credentials, and accepting the license. Both `Wca4zEnabled` and `Wxa4zEnabled` flags must be set to true. ```yaml apiVersion: ai-optimizer4z.ibm.com/v1alpha1 kind: AIOptimizer4zStack metadata: name: ai-optimizer4zstack-sample namespace: ai-optimizer4z spec: Wca4zEnabled: true Wxa4zEnabled: true byos_user_provided_crentials_ref: byos-credentials cpd_api_token_secret_ref: ai-optimizer4z-token-secret cpd_instance_ns: cpd_operator_ns: license: accept: true ``` -------------------------------- ### Deploy watsonx Code Assistant for Z on x86 Systems (YAML) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=deploying-gen-ai-services This configuration deploys watsonx Code Assistant for Z to an OCP cluster on an x86 system. It requires specifying namespaces and accepting the license. The `Wca4zEnabled` flag must be set to true. ```yaml apiVersion: ai-optimizer4z.ibm.com/v1alpha1 kind: AIOptimizer4zStack metadata: name: ai-optimizer4zstack-sample namespace: ai-optimizer4z spec: Wca4zEnabled: true Wxa4zEnabled: false cpd_api_token_secret_ref: ai-optimizer4z-token-secret cpd_instance_ns: cpd_operator_ns: license: accept: true ``` -------------------------------- ### Edit BYOSearch Resource to Create Route Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-resolving-known-issues Opens the BYOSearch resource in the 'vi' editor to enable route creation for ZAssistantDeploy service. This is done by setting the 'createRoute' option to 'true' under the 'wrapper' parameter. ```bash oc edit -n wxa4z-byos byosearches.wxa4z.watsonx.ibm.com byosearch ``` -------------------------------- ### Create AI Optimizer for Z Namespace Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=deploying-gen-ai-services Creates a new namespace named 'ai-optimizer4z' within the OCP cluster for the AI Optimizer for Z instance. This isolates the deployment resources. ```bash oc create namespace ai-optimizer4z ``` -------------------------------- ### Deploy watsonx Assistant for Z Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=deploying-gen-ai-services Deploys the IBM watsonx Assistant for Z service by applying a custom resource definition (CRD) to the 'ai-optimizer4z' namespace. It enables the Wxa4zEnabled flag and references the 'byos-credentials' secret. ```yaml apiVersion: ai-optimizer4z.ibm.com/v1alpha1 kind: AIOptimizer4zStack metadata: name: ai-optimizer4zstack-sample namespace: ai-optimizer4z spec: Wca4zEnabled: false Wxa4zEnabled: true byos_user_provided_crentials_ref: byos-credentials ``` -------------------------------- ### Verify watsonx Assistant for Z Deployment (Shell) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=deploying-gen-ai-services This command verifies the deployment status of watsonx Assistant for Z custom resources across all namespaces. Successful deployment is indicated when the 'Deployed', 'Verified', and 'Total' counts match. ```bash oc get watsonxorchestrates.wo.watsonx.ibm.com -A ``` -------------------------------- ### Verify watsonx Code Assistant for Z Deployment (Shell) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=deploying-gen-ai-services This command verifies the deployment status of the watsonx Code Assistant for Z custom resource. A successful deployment is indicated by a 'Completed' status in the command output. ```bash oc get wcazs.wca.cpd.ibm.com -A ``` -------------------------------- ### Retrieve AI Optimizer for Z Operator Catalog Pod Logs using oc logs Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-collecting-logs-troubleshooting Fetches logs from the AI Optimizer for Z operator catalog pod and directs them to a specified file. Requires the operator catalog pod name and the target log file name. ```shell oc logs -n ai-optimizer4z-operator-system > ``` -------------------------------- ### Retrieve AI Optimizer for Z UI Pod Logs using oc logs Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-collecting-logs-troubleshooting Collects logs from a specified AI Optimizer for Z UI pod and saves them to a local file. Requires the UI pod name and the desired output filename. ```shell oc logs -n ai-optimizer4z > ``` -------------------------------- ### Recreate Db2uCluster Resource Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-resolving-known-issues Deletes and subsequently recreates the Db2uCluster resource to resolve stuck reconciliation processes. This action is necessary when the Db2 instance state is not 'Ready'. ```bash oc delete db2uclusters.db2u.databases.ibm.com -n db2oltp-21212121 ``` -------------------------------- ### Retrieve watsonx Assistant for Z Pod Statuses (Shell) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=deploying-gen-ai-services This command retrieves the status of service pods for watsonx Assistant for Z. It is useful for diagnosing deployment issues. The expected status for each pod is 'Running' or 'Completed'. ```bash % oc get pods -n wxa4z-byos ``` -------------------------------- ### Log in to OCP Cluster Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=dgas-accessing-ai-optimizer-z-deployed-gen-ai-services This command logs you into the OpenShift Container Platform (OCP) cluster as an administrator. You will need to provide your OCP username, password, and the cluster address. This is a prerequisite for executing subsequent commands within the cluster. ```bash oc login -u -p ``` -------------------------------- ### Create BYOS Credentials Secret Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=deploying-gen-ai-services Creates a Kubernetes secret named 'byos-credentials' in the 'ai-optimizer4z' namespace. This secret is required if deploying the IBM watsonx Assistant for Z service, as it stores credentials for the associated BYOS (ZAssistantDeploy) service, including OpenSearch and authentication details. ```yaml apiVersion: v1 kind: Secret metadata: name: byos-credentials namespace: ai-optimizer4z type: Opaque stringData: opensearch-password: client-ingestion-authkey: wrapper-username: wrapper-password: ``` -------------------------------- ### Check Db2uCluster State Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-resolving-known-issues Retrieves the current state of the Db2uCluster resource across all namespaces. This command helps diagnose issues with Db2 instance reconciliation. ```bash oc get db2uclusters.db2u.databases.ibm.com -A ``` -------------------------------- ### Retrieve AI Optimizer for Z API Pod Logs using oc logs Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-collecting-logs-troubleshooting Collects logs from a specified AI Optimizer for Z REST API pod and saves them to a local file. Requires the API pod name and the desired output filename. ```shell oc logs -n ai-optimizer4z > ``` -------------------------------- ### Retrieve AI Optimizer for Z Operator Controller Pod Logs using oc logs Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-collecting-logs-troubleshooting Extracts logs from the AI Optimizer for Z operator controller pod and saves them into a designated file. Requires the operator controller pod name and the desired log file path. ```shell oc logs -n ai-optimizer4z-operator-system > ``` -------------------------------- ### Archive Log Files using zip or tar Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-collecting-logs-troubleshooting Compresses collected log files into a single archive (e.g., zip or tar) for easier management and sharing. This step is optional but recommended for consolidated log management. ```shell # Example using zip command: zip # Example using tar command: tar -czvf ``` -------------------------------- ### Verify Global Pull Secret Update (Shell) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=installing-ai-optimizer-z Monitors the machine configuration pools in the OCP cluster to verify that the updated global pull secret has taken effect and the cluster is running normally after node restarts. ```shell oc get machineconfigpool -w ``` -------------------------------- ### Remove Helper Namespaces using oc delete Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-uninstalling-ai-optimizer Deletes specific namespaces related to AI Optimizer for Z command execution and API management. The --ignore-not-found flag prevents errors if the namespaces do not exist. This is a preparatory step before removing the main AI Optimizer components. ```bash oc delete --ignore-not-found namespaces cpd-cli-manage-command-execution oc delete --ignore-not-found namespaces cpd-api ``` -------------------------------- ### Update Global Pull Secret with Entitlement Key (Shell) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=installing-ai-optimizer-z Updates the global pull secret by adding a new entry for the AI Optimizer for Z entitlement key. This command uses basic authentication with your entitlement key. ```shell oc registry login --registry="cp.icr.io" --auth-basic="cp:" --to=.dockerconfigjson ``` -------------------------------- ### Extract Global Pull Secret (Shell) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=installing-ai-optimizer-z Extracts the existing global pull secret from the OCP cluster configuration. This secret is then modified to include the AI Optimizer for Z entitlement key. ```shell oc extract secret/pull-secret -n openshift-config --keys=.dockerconfigjson --to=. --confirm ``` -------------------------------- ### Set CPDM OC Login Environment Variable Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=services-configuring-deployed-gen-ai This command sets the CPDM_OC_LOGIN environment variable, which is used for logging into the OCP cluster via the cpd-cli. This variable is crucial for the AI Optimizer for Z to interact with your deployed services. Replace placeholders with your specific credentials and cluster address. ```bash export CPDM_OC_LOGIN="cpd-cli manage login-to-ocp -u -p " ``` -------------------------------- ### Upload Updated Global Pull Secret (Shell) Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=installing-ai-optimizer-z Uploads the modified global pull secret back to the OCP cluster configuration. A successful update triggers a node restart. ```shell oc set data secret/pull-secret -n openshift-config --from-file=.dockerconfigjson ``` -------------------------------- ### Remove AI Optimizer for Z UI and Components using oc delete Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-uninstalling-ai-optimizer Removes the core AI Optimizer for Z application, its API cluster role, and binding. It also includes commands to delete TLS secrets and certificates, which require specifying the Cloud Pak for Data instance namespace. Ensure you replace '' with your actual namespace. ```bash oc delete namespaces ai-optimizer4z oc delete clusterrole ai-optimizer4z-api-cluster-role oc delete clusterrolebinding ai-optimizer4z-api-account-binding oc delete secret ai-optimizer4z-tls -n oc delete certificate ai-optimizer4z-certificate -n ``` -------------------------------- ### Create AI Optimizer Token Secret Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=deploying-gen-ai-services Creates a Kubernetes secret named 'ai-optimizer4z-token-secret' in the 'ai-optimizer4z' namespace. This secret stores the OCP session token, which is required for the AI Optimizer for Z operator to access cluster resources. ```yaml apiVersion: v1 kind: Secret metadata: name: ai-optimizer4z-token-secret namespace: ai-optimizer4z type: Opaque stringData: token: ``` -------------------------------- ### Remove AI Optimizer for Z Operator and Resources Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=z-uninstalling-ai-optimizer This procedure uses 'oc delete' commands to remove the AI Optimizer for Z operator, its associated namespaces, and other Kubernetes resources. It includes removing custom resource definitions (CRDs), cluster roles, and operator system components. ```bash # remove operator and operator namespace oc delete ai-optimizer4zstacks.ai-optimizer4z.ibm.com -A --all oc delete subscriptions.operators.coreos.com ai-optimizer4z-operator -n ai-optimizer4z-operator-system oc delete clusterserviceversions.operators.coreos.com ai-optimizer4z-operator.v1.1.0 -n ai-optimizer4z-operator-system oc delete crd ai-optimizer4zstacks.ai-optimizer4z.ibm.com oc delete operators.operators.coreos.com ai-optimizer4z-operator.ai-optimizer4z-operator-system oc delete namespaces ai-optimizer4z-operator-system # remove additional resources oc delete clusterroles.rbac.authorization.k8s.io ai-optimizer4z-operator-ai-optimizer4zstack-editor-role oc delete clusterroles.rbac.authorization.k8s.io ai-optimizer4z-operator-ai-optimizer4zstack-viewer-role oc delete clusterroles.rbac.authorization.k8s.io ai-optimizer4z-operator-metrics-reader ``` -------------------------------- ### Obtain OCP Session Token Source: https://www.ibm.com/docs/en/ai-optimizer-for-z/1.1_topic=deploying-gen-ai-services Retrieves the current OCP session or OAuth access token. This token is a bearer token (JSON web token) used by the AI Optimizer for Z REST API for cluster access. It typically expires after 24 hours and may need refreshing. ```bash oc whoami --show-token ```