|
| 1 | +# Quick Start Guide |
| 2 | + |
| 3 | +Use this Quick Start Guide to create a WebLogic deployment in a Kubernetes cluster. |
| 4 | + |
| 5 | +## 1. Get the images and put them into your local registry. |
| 6 | +The Operator image: |
| 7 | +``` |
| 8 | +$ docker pull oracle/weblogic-kubernetes-operator:2.0 |
| 9 | +``` |
| 10 | +The Traefik image: |
| 11 | +``` |
| 12 | +$ docker pull traefik:latest |
| 13 | +``` |
| 14 | +## 2. Create a Traefik (Ingress-based) load balancer. |
| 15 | +Use Helm to install the [Traefik](samples/charts/traefik/README.md) load balancer. |
| 16 | +``` |
| 17 | +$ helm install --name traefik-operator --namespace traefik stable/traefik |
| 18 | +``` |
| 19 | +## 3. Configure Kibana and Elasticsearch. |
| 20 | + |
| 21 | +Use the YAML file under https://github.com/oracle/weblogic-kubernetes-operator/blob/develop/kubernetes/samples/scripts/elasticsearch_and_kibana.yaml. |
| 22 | +``` |
| 23 | +$ kubectl apply -f kubernetes/samples/scripts/elasticsearch_and_kibana.yaml |
| 24 | +``` |
| 25 | + |
| 26 | +## 4. Install the operator. |
| 27 | +* Create a namespace for the operator: |
| 28 | +``` |
| 29 | +$ kubectl create namespace weblogic-operator |
| 30 | +``` |
| 31 | +* Create a `serviceAccount` for the operator's namespace. If not specified, it defaults to `default` (for example, the namespace's default service account). |
| 32 | +* Invoke the script to generate the credentials for the operator and add it to the operator YAML file (all the values can be kept as default). |
| 33 | +* Create the operator using `helm install`, and passing in the namespace, service account, and location of Elasticsearch. |
| 34 | + * Helm is used to deploy the operator in a Kubernetes cluster. |
| 35 | + * Use the `helm install` command to install the operator Helm chart, passing in the `values.yaml`. |
| 36 | + * Edit the `values.yaml` file to update the information such as the operator's namespace and service account. |
| 37 | +``` |
| 38 | + $ helm install kubernetes/charts/weblogic-operator --name my-operator --namespace weblogic-operator-ns --values values.yaml --wait |
| 39 | +``` |
| 40 | + |
| 41 | +## 5. Prepare your environment for a domain. |
| 42 | +* Optionally, create a domain namespace if you want to persist the domain home in a PV or the WebLogic server logs: |
| 43 | +``` |
| 44 | +$ kubectl create namespace domain1-ns |
| 45 | +``` |
| 46 | +* Create the Kubernetes secrets for the Administration Server boot credentials by invoking the script: |
| 47 | +``` |
| 48 | +https://github.com/oracle/weblogic-kubernetes-operator/blob/develop/kubernetes/samples/scripts/create-weblogic-domain/create-weblogic-credentials.sh |
| 49 | +``` |
| 50 | +* Create a PV & PVC for the domain: |
| 51 | + * Find the `create_pv_pvc.sh script` and the YAML file you'll need to edit to create the PV and PVC, in the https://github.com/oracle/weblogic-kubernetes-operator/tree/develop/kubernetes/samples/scripts/create-weblogic-domain-pv-pvc directory. |
| 52 | +* Edit the operator YAML file to add the domain namespace, then do a `helm upgrade`. |
| 53 | +* Create the Docker image for the domain home in the image or use the WebLogic binary image. |
| 54 | + * Run WLST to create the domain in PV (remember to apply the patch). |
| 55 | + |
| 56 | +## 6. Create a domain. |
| 57 | +* Edit the domain YAML file (can the defaults be used?). |
| 58 | +* Create the domain home for the domain. |
| 59 | + * For a domain home on a PV, first pull the WebLogic 12.2.1.3 install image into a local repository: |
| 60 | +``` |
| 61 | +$ docker pull store/oracle/weblogic:12.2.1.3-dev |
| 62 | +``` |
| 63 | + * For reference, see https://github.com/oracle/weblogic-kubernetes-operator/blob/develop/kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/README.md. |
| 64 | + * The `create-domain.sh` will: |
| 65 | + * Create a directory for the generated Kubernetes YAML files for this domain. The pathname is `/path/to/weblogic-operator-output-directory/weblogic-domains/`. |
| 66 | + * Create a Kubernetes job that will start up a utility WebLogic Server container and run offline WLST scripts, or WebLogic Deploy Tool (WDT) scripts, to create the domain on the shared storage. |
| 67 | + * Run and wait for the job to finish. |
| 68 | + * Create a Kubernetes domain custom resource YAML file, `domain-custom-resource.yaml`, in the directory that is created above. You can use this YAML file to create the Kubernetes resource using the `kubectl create -f` or `kubectl apply -f` command: |
| 69 | + ``` |
| 70 | +./create-domain.sh |
| 71 | +-i create-domain-inputs.yaml |
| 72 | +-o /path/to/output-directory |
| 73 | +``` |
| 74 | + * For a domain home in image, use the sample in the Docker GitHub project. |
| 75 | +* Optionally, create a configuration overrides template and any additional Kubernetes secrets it needs (for example, to override the domain home configuration of a database URL, username, and password). |
| 76 | +* Create a domain resource in the domain namespace. |
| 77 | + * Specify the following information: domain UID, service account, secret name, the domain home details, and optionally, the configuration overrides template name. |
| 78 | +* Configure the operator to know about the domain. |
| 79 | + * Edit the operator `values.yaml` file to add the namespace of the domain: |
| 80 | + ``` |
| 81 | +$ helm update kubernetes/charts/weblogic-operator --name my-operator --namespace weblogic-operator-ns --values values.yaml --wait |
| 82 | +``` |
| 83 | +* Configure the Traefik load balancer to manage the domain as follows: |
| 84 | + * Create an Ingress for the domain in the domain namespace (it contains the routing rules for the domain): |
| 85 | +``` |
| 86 | +$ cd kubernetes/samples/charts |
| 87 | +$ helm install ingress-per-domain --name domain1-ingress --value values.yaml |
| 88 | +``` |
| 89 | + |
| 90 | +(At this point, do they have a WebLogic Kubernetes deployment in a Kubernetes cluster? If so, we have to give them something to look at, to verify their results.) |
| 91 | + |
| 92 | +## 7. Remove a domain. |
| 93 | +* Remove the domain's Kubernetes resources (domain, secrets, ingress, and such) |
| 94 | + * To remove the domain and all the Kubernetes resources (labeled with the `domainUID`), invoke the script: |
| 95 | + ``` |
| 96 | +https://github.com/oracle/weblogic-kubernetes-operator/blob/develop/kubernetes/samples/scripts/delete-weblogic-domain-resources.sh |
| 97 | + ``` |
| 98 | + * The operator will notice that the domain's domain resource has been removed and will then kill the pods. |
| 99 | +* Configure the Traefik load balancer to stop managing the domain. |
| 100 | + * If you have configured Traefik to manage the domain's namespace (instead of the default: all namespaces), then edit the Traefik YAML file to remove the domain namespace and do a `helm update`: |
| 101 | +``` |
| 102 | + helm update --name traefik-operator --namespace traefik (default values in yaml) |
| 103 | +or |
| 104 | +helm update --name traefik-operator --namespace traefik --values values.yaml stable/traefik |
| 105 | +``` |
| 106 | + |
| 107 | +* Remove the domain home if it's on a PV. |
| 108 | + |
| 109 | +## 8. Remove the domain namespace. |
| 110 | +* Configure the Traefik load balancer to stop managing the domain namespace. Use `helm upgrade` to remove the domain namespace from the list of namespaces. |
| 111 | +* Configure the operator to stop managing the domain. Use `helm upgrade` to remove the domain namespace from the list of domain namespaces. |
| 112 | +* Remove the PV & PVC for the domain namespace. |
| 113 | +* Remove the domain namespace: |
| 114 | +``` |
| 115 | +$ kubectl delete namespaces domain1-ns |
| 116 | +``` |
| 117 | + |
| 118 | +## 9. Remove the operator. |
| 119 | +``` |
| 120 | +helm delete --purge my-operator |
| 121 | +``` |
| 122 | +* Remove the operator namespace: |
| 123 | +``` |
| 124 | +$ kubectl delete namespaces weblogic-operator-ns |
| 125 | +``` |
| 126 | + |
| 127 | +## 10. Remove other resources. |
| 128 | +* Optionally, remove Kibana and Elasticsearch: |
| 129 | +``` |
| 130 | +$ kubectl apply -f kubernetes/samples/scripts/elasticsearch_and_kibana.yaml |
| 131 | +``` |
| 132 | +* Remove the Traefik load balancer: |
| 133 | +``` |
| 134 | +helm delete --purge |
| 135 | +``` |
| 136 | +* Remove the Traefik namespace: |
| 137 | +``` |
| 138 | +$ kubectl delete namespaces traefik |
| 139 | +``` |
0 commit comments