Assigning Pods to Nodes - Implementing Affinity and Anti-affinity on OKE using Siebel Cloud Manager

Using SCM, you can constrain a pod so that it is restricted to run on particular node(s) or to prefer to run on particular nodes. There are several ways to do this and the recommended approaches all use label selectors to facilitate the selection. Affinity definitions are available in Kubernetes API reference. These can be added as a customization in configuration.

This topic has the following sections:

Customizing the Configuration with Affinity

Affinity changes will go as a customization that require changes in the SCM repository. Affinity can be defined for the following Siebel pods:

  • Siebel Server pods (edge, tibus and so on)
  • Sai Server pods (quantum, alchemist and so on)
  • cgw pod
  • smc pod

To add affinity:

  1. SSH into the SCM instance.
  2. Enter commands like the following:
    docker exec -it cloudmanager bash
  3. Override the configuration in different Siebel CR pods:
    1. Edit the /home/opc/siebel/<env_id>/<namespace>-cloud-manager/flux-crm/apps/base/siebel/siebel.yaml file to add "affinity" for each Siebel server/SAI server as:
      •    sesServer:
           - profile: sieb_server_profile1
             replicas: 1
             siebsrvr_prefix: tibus
             affinity:
               podAffinity:
                 requiredDuringSchedulingIgnoredDuringExecution:
                 - labelSelector:
                     matchExpressions:
                     - key: app.siebel.tier
                       operator: In
                       values:
                       - edge
                   topologyKey: kubernetes.io/hostname
                   weight: 100
      •   saiServer:
           - profile: ai_automotive_greenfield
             replicas: 1
             sai_prefix: quantum
             affinity:
               nodeAffinity:
                 preferredDuringSchedulingIgnoredDuringExecution:
                 - weight: 1
                 preference:
                   matchExpressions:
                   - key: topology.kubernetes.io/zone
                     operator: In
                     values:
                     - UK-LONDON-1-AD-1
    2. Edit the /home/opc/siebel/<env_id>/<namespace>-cloud-manager/flux-crm/apps/base/siebel/siebel-gateway.yaml file to add "affinity" for siebel-gateway (CGW) pods:
         cgw:
           replicas: 3
           affinity:
             podAntiAffinity:
               preferredDuringSchedulingIgnoredDuringExecution:
               - weight: 100
                 podAffinityTerm:
                   labelSelector:
                     matchExpressions:
                     - key: app.siebel.tier
                       operator: In
                       values:
                       - cgw
                   topologyKey: "kubernetes.io/hostname"
    3. Sameway, affinity can also be added to SMC pod by editing /home/opc/siebel/<env_id>/<namespace>-cloud-manager/flux-crm/apps/base/siebel/siebel-gateway.yaml:
      smc:
           affinity:{} // affinity definition for smc pod goes here
  4. Commit your customization in the SCM Git repository. Make sure to add all modified files. The above changes will be included in the initial environment provisioning, where you specify the configuration ID.
  5. Check the status of a requested configuration. For more information, see Checking the Status of a Requested Configuration.
  6. Deploy the environment with the customized configuration. In this step you specify only the configuration ID and the deployment name. For more information, see Deploying Siebel CRM on OCI using Siebel Cloud Manager.

Use Cases for Making Incremental Changes

Here are some use cases for adding affinity definitions to individual Siebel pods.

Adding affinity for individual Siebel Server

  1. Exec into the SCM container:
    docker exec -it cloudmanager bash
  2. Edit: siebel.yaml under /home/opc/siebel/<env_id>/<namespace>-cloud-manager/flux-crm/apps/base/siebel
       sesServer:
       - profile: sieb_server_profile1
         replicas: 1
         siebsrvr_prefix: edge
         affinity:
           nodeAffinity:
             requiredDuringSchedulingIgnoredDuringExecution:
               nodeSelectorTerms:
               - matchExpressions:
                 - key: topology.kubernetes.io/zone
                   operator: In
                   values:
                   - UK-LONDON-1-AD-2
             preferredDuringSchedulingIgnoredDuringExecution:
             - weight: 1
               preference:
                 matchExpressions:
                 - key: another-node-label-key
                   operator: In
                   values:
                   - another-node-label-value
  3. Run the following commands:
    git pull
    git add .
    git commit -m "<message>"
    git push

Adding affinity for individual Sai Server

  1. Edit: siebel.yaml under /home/opc/siebel/<env_id>/<namespace>-cloud-manager/flux-crm/apps/base/siebel
       saiServer:
       - profile: application_interface_profile1
         replicas: 1
         sai_prefix: quantum
         affinity:
           nodeAffinity:
             requiredDuringSchedulingIgnoredDuringExecution:
               nodeSelectorTerms:
               - matchExpressions:
                 - key: topology.kubernetes.io/zone
                   operator: In
                   values:
                   - UK-LONDON-1-AD-1
  2. Run the following commands:
    git pull
    git add .
    git commit -m "<message>"
    git push

Adding affinity for CGW pods

  1. Edit: siebel-gateway.yaml under /home/opc/siebel/<env_id>/<namespace>-cloud-manager/flux-crm/apps/base/siebel
       cgw:
         replicas: 3
         affinity: {} // affinity definition for cgw pod goes here.
  2. Run the following commands:
    git pull
    git add .
    git commit -m "<message>"
    git push

Adding affinity for SMC pod

  1. Edit: siebel-gateway.yaml under /home/opc/siebel/<env_id>/<namespace>-cloud-manager/flux-crm/apps/base/siebel
       smc:
         affinity: {} // affinity definition for smc pod goes here.
  2. Run the following commands:
    git pull
    git add .
    git commit -m "<message>"
    git push