You can deploy the image file in the Tanzu Kubernetes Grid cluster.

Prerequisites

  • Tanzu Kubernetes Grid cluster.
  • Successful containerization on a Oracle WebLogic Server component.
  • Perform the following steps to deploy Oracle’s WebLogic Kubernetes operator in the cluster.
    • Run the following commands:
    • Install WebLogic Operator:
      • Create a namespace and service account for the operator.
        kubectl create namespace sample-weblogic-operator-ns
        kubectl create serviceaccount -n sample-weblogic-operator-ns sample-weblogic-operator-sa
      • Install Helm, which is required for the operator.
        helm install sample-weblogic-operator kubernetes/charts/weblogic-operator \
        --namespace sample-weblogic-operator-ns \
        --set image=oracle/weblogic-kubernetes-operator:3.1.0 \
        --set serviceAccount=sample-weblogic-operator-sa \
        --set "enableClusterRoleBinding=true" \
        --set "domainNamespaceSelectionStrategy=LabelSelector" \
        --set "domainNamespaceLabelSelector=weblogic-operator\=enabled" \
        --wait
        
        kubectl get pods -n sample-weblogic-operator-ns
         
        # Verify the status weblogic-operator pod
        kubectl get pods -n sample-weblogic-operator-ns
        #Output
        NAME                             	READY   STATUS	RESTARTS   AGE
        weblogic-operator-54c6f7464c-926xz   1/1     Running   0    2d12h

Procedure

  1. Download the image artifacts ZIP file from the link provided in components details and extract it.
  2. Update create_k8s_secrets.sh with specific details like, namespace, username and password for all the secrets.
  3. Create domain namespace.
    # create domain namespace
    kubectl create namespace demo
     
    # upgrade weblogic-operator with the Domain namespace
    kubectl label ns demo weblogic-operator=enabled
  4. Create secrets for registry in the same namespace.
    #!/bin/bash
     set -eu
    
    # Edit these values to change the namespace or domain UID
    NAMESPACE=demo
    DOMAIN_UID=wldomain1
     
    function create_k8s_secret {
      kubectl -n $NAMESPACE delete secret ${DOMAIN_UID}-$1 --ignore-not-found
      kubectl -n $NAMESPACE create secret generic ${DOMAIN_UID}-$1 --from-literal=password=$2
      kubectl -n $NAMESPACE label secret ${DOMAIN_UID}-$1 weblogic.domainUID=${DOMAIN_UID}
    }
     
    function create_paired_k8s_secret {
      kubectl -n $NAMESPACE delete secret ${DOMAIN_UID}-$1 --ignore-not-found
      kubectl -n $NAMESPACE create secret generic ${DOMAIN_UID}-$1 --from-literal=username=$2 --from-literal=password=$3
      kubectl -n $NAMESPACE label secret ${DOMAIN_UID}-$1 weblogic.domainUID=${DOMAIN_UID}
    }
     
    # Update <admin-user> and <admin-password> for weblogic-credentials
    create_paired_k8s_secret weblogic-credentials <admin-user> <admin-password>
     
    # Update <user> and <password> for jdbc-jdbc-data-source-0
    create_paired_k8s_secret jdbc-jdbc-data-source-0 c##test <password>
     
    # Update <password> for runtime-encryption-secret, This is a special secret required by Model in Image.
    create_k8s_secret runtime-encryption-secret <password>
  5. Execute the script and verify the secrets are created in the namespace and verify the secrets are created. successfully
    kubectl get secrets -n demo
    
    #Output
    NAME                                  TYPE                                  DATA   AGE
    default-token-6ls2z                   kubernetes.io/service-account-token   3      5d13h
    docker-secret                         kubernetes.io/dockerconfigjson        1      4d22h
    harbor-cred                           kubernetes.io/dockerconfigjson        1      4d22h
    wldomain1-jdbc-jdbc-data-source-0     Opaque                                2      3d14h
    wldomain1-runtime-encryption-secret   Opaque                                1      3d14h
    wldomain1-weblogic-credentials        Opaque                                2      3d14h
  6. Prepare and Deploy the Domain.
    1. Download the Domain.yaml.extn file and add and update the following parameters to create the Domain.yaml for deployment.
      • image: Enter the name of the WebLogic domain image
      • domainHomeSourceType: FromModel
      • webLogicCredentialsSecret
      • JAVA_OPTIONS "-Dweblogic.security.SSL.ignoreHostnameVerification=true"
      • runtimeEncryptionSecret
      • Add introspectorJobActiveDeadlineSeconds with time in seconds (example - 600 ) for slow networks if introspector POD continues to create and terminate in loop.
      • Additional secrets created after running previous script, if any.

    Sample Domain.yaml

    kind: Domain
    metadata:
        name: wldomain1
    spec:
        domainHome: /home/oracle/WLDOMAIN1
        image: 'imthangadurai/wl_12_1_0_3:1.0.0'
        domainHomeSourceType: FromModel
        imagePullSecrets:
        -   name: 'docker-secret'
        webLogicCredentialsSecret:
          name: wldomain1-weblogic-credentials
        clusters:
        -   clusterName: 'Cluster-0'
            replicas: 2
            serverPod:
              env:
               - name: JAVA_OPTIONS
                 value: "-Dweblogic.security.SSL.ignoreHostnameVerification=true"
        configuration:
            introspectorJobActiveDeadlineSeconds: 600
            model:
                domainType: WLS
                runtimeEncryptionSecret: 'wldomain1-runtime-encryption-secret'
            secrets:
            -   'wldomain1-weblogic-credentials'
            -   'wldomain1-jdbc-jdbc-data-source-0'
  7. Deploy the updated Domain.yaml in the same namespace and introspector pod comes up first and pulls the Oracle WebLogic Server image and created domain pods (Example: admin, server-0, server-1, etc.)
    kubectl apply -f Domain.yaml -n <namespace>
     
    # Watch for the status of the pods
    # admin server, managed-server1 and managed-server2 needs to be in running state
     
    kubectl get pods -n demo --watch
     
     
    NAME                       	READY   STATUS	RESTARTS   AGE
    wldomain1-introspector-bq4dt   1/1     Running   0      	100s
    wldomain1-introspector-bq4dt   0/1     Completed   0      	114s
    wldomain1-introspector-bq4dt   0/1     Terminating   0      	115s
    wldomain1-introspector-bq4dt   0/1     Terminating   0      	115s
    wldomain1-adminserver      	0/1     Pending   	0      	0s
    wldomain1-adminserver      	0/1     Pending   	0      	0s
    wldomain1-adminserver      	0/1     ContainerCreating   0      	0s
    wldomain1-adminserver      	0/1     Running         	0      	2s
     
    # This confirms the pods are running successfully
     
    kubectl get pods -n demo
    NAME                	READY   STATUS	RESTARTS   AGE
    wldomain1-adminserver   1/1     Running   0      	16m
    wldomain1-server-0  	1/1     Running   0      	15m
    wldomain1-server-1  	1/1     Running   0      	15m
    wldomain1-server-3  	1/1     Running   0      	15m
    wldomain1-server-4  	1/1     Running   0      	15m
  8. Perform one of the following for accessing the Oracle WebLogic Server admin server:
    • Create an ingress controller like traefik, or
    • Expose the services using the following commands:
      kubectl expose pod <pod-name>  --port=<port>  --target-port=<port> --name porname --type=LoadBalancer
      kubectl patch svc portname-p '{"spec": {"type" : "LoadBalancer", "externalIPs":["<LB-IP>"]}}'