|
| 1 | +--- |
| 2 | +title: "Istio support" |
| 3 | +date: 2019-08-15T13:30:04-04:00 |
| 4 | +weight: 1 |
| 5 | +--- |
| 6 | + |
| 7 | +### Overview |
| 8 | + |
| 9 | +WebLogic Kubernetes Operator version 2.3 includes experimental support for Istio 1.2.2. |
| 10 | +This support allows you to run the operator itself, and WebLogic domains managed by |
| 11 | +the operator with Istio sidecar injection enabled. It will allow you to use |
| 12 | +Istio gateways and virtual services to access applications deployed in these domains. |
| 13 | +If your applications have suitable tracing code in them, you will also be able to |
| 14 | +use distributed tracing, such as Jaeger, to trace requests across domains and to |
| 15 | +other components and services that have tracing enabled. |
| 16 | + |
| 17 | +### Limitations |
| 18 | + |
| 19 | +The current experimental support for Istio has the current limitations: |
| 20 | + |
| 21 | +* It is tested only with Istio 1.2.2, however it is tested with both single and |
| 22 | + multicluster installations of Istio. |
| 23 | +* Support is provided only for domains that are stored in persistent |
| 24 | + volumes and created with the provided sample using the WLST option. |
| 25 | + We intend to support domain in image and WDT options as well, but that is not currently |
| 26 | + available. |
| 27 | +* Support is provided only for domains with a single dynamic cluster. |
| 28 | + Multiple clusters and configured clusters are not currently supported. |
| 29 | + |
| 30 | +### Using the operator with experimental Istio support |
| 31 | + |
| 32 | +You can deploy the operator into a namespace which has Istio automatic sidecar |
| 33 | +injection enabled. Before installing the operator, create the namespace you |
| 34 | +wish to run the operator in, and label it for automatic injection. |
| 35 | + |
| 36 | +``` |
| 37 | +$ kubectl create namespace weblogic-operator |
| 38 | +$ kubectl label namespace weblogic-operator istio-injection=enabled |
| 39 | +``` |
| 40 | + |
| 41 | +After the namespace is labeled, you can install the operator using the normal |
| 42 | +method. When the operator pod starts, you will notice that Istio automatically |
| 43 | +injects an `initContainer` called `istio-init` and the envoy container `istio-proxy`. |
| 44 | + |
| 45 | +You can check this using the following commands: |
| 46 | + |
| 47 | +``` |
| 48 | +$ kubectl --namespace weblogic-operator get pods |
| 49 | +$ kubectl --namespace weblogic-operator get pod weblogic-operator-xxx-xxx -o yaml |
| 50 | +``` |
| 51 | + |
| 52 | +In the second command, change `weblogic-operator-xxx-xxx` to the name of your pod. |
| 53 | + |
| 54 | +### Creating a domain with experimental Istio support |
| 55 | + |
| 56 | +You can configure your domains to run with Istio automatic sidecar injection enabled. |
| 57 | +Before creating your domain, create the namespace you wish to run the domain in, |
| 58 | +and label it for automatic injection. |
| 59 | + |
| 60 | +``` |
| 61 | +$ kubectl create namespace domain1 |
| 62 | +$ kubectl label namespace domain1 istio-injection=enabled |
| 63 | +``` |
| 64 | + |
| 65 | +Currently, the experimental Istio support is provided only for domains stored on |
| 66 | +persistent volumes. To enable the support for a domain, you need to add the |
| 67 | +`experimental` section to your domain custom resource YAML file as shown in the |
| 68 | +example below. |
| 69 | + |
| 70 | +This *must* be done in the inputs file before running the `create-domain.sh` script |
| 71 | +in the [sample directory]({{< relref "/samples/simple/domains/domain-home-on-pv" >}}) |
| 72 | +because the `create-domain.sh` script makes the necessary adjustments to the domain |
| 73 | +to make it work in an Istio environment. |
| 74 | + |
| 75 | +``` |
| 76 | +apiVersion: "weblogic.oracle/v5" |
| 77 | +kind: Domain |
| 78 | +metadata: |
| 79 | + name: domain2 |
| 80 | + namespace: domain1 |
| 81 | + labels: |
| 82 | + weblogic.resourceVersion: domain-v2 |
| 83 | + weblogic.domainUID: domain2 |
| 84 | +spec: |
| 85 | + ... other content ... |
| 86 | + experimental: |
| 87 | + istio: |
| 88 | + enabled: true |
| 89 | + readinessPort: 8888 |
| 90 | +``` |
| 91 | + |
| 92 | +To enable the experimental Istio support, you must include the `istio` section |
| 93 | +and you must set `enabled: true` as shown. The `readniessPort` is optional |
| 94 | +and defaults to `8888` if not provided. |
| 95 | + |
| 96 | +#### How Istio-enabled domains differ from regular domains |
| 97 | + |
| 98 | +Istio enforces a number of requirements on pods. When you enable Istio support, the |
| 99 | +domain on persistent volume sample scripts will make the following adjustments |
| 100 | +to your domain in order to satisy Istio's requirements: |
| 101 | + |
| 102 | +* On the Admin server: |
| 103 | + * Create a channel called `istio-probe` with listen address `127.0.0.1:8888` (or |
| 104 | + the port you specified in the `readinessPort` setting). |
| 105 | + * Create a channel called `istio-t3` with listen address `127.0.0.1` and the port |
| 106 | + you specified as the admin port. |
| 107 | + * Create a channel called `istio-ldap` with listen address `127.0.0.1` and the port |
| 108 | + you specified as the admin port, with only the LDAP protocol enabled. |
| 109 | + * Create a channel called `istio-T3Channel` with listen |
| 110 | + address `127.0.0.1` and the port you specified as the T3 port. |
| 111 | +* In the server template that is used to create managed servers in clusters: |
| 112 | + * Create a channel called `istio-probe` with listen address `127.0.0.1:8888` (or |
| 113 | + the port you specified in the `readinessPort` setting) and the public address |
| 114 | + set to the Kubernetes service for the managed server. |
| 115 | + * Create a channel called `istio-t3` with listen address `127.0.0.1` and the port |
| 116 | + you specified as the admin port and the public address |
| 117 | + set to the Kubernetes service for the managed server. |
| 118 | + * Create a channel called `istio-cluster` with listen address `127.0.0.1` and the port |
| 119 | + you specified as the admin port, with only the CLUSTER_BROADCAST protocol enabled, |
| 120 | + and the public address set to the Kubernetes service for the managed server. |
| 121 | + * Create a channel called `istio-http` with listen address `127.0.0.1:31111` and the |
| 122 | + public address set to the Kubernetes service for the managed server. Note that `31111` |
| 123 | + is the Istio proxy (envoy) port. |
| 124 | +* The create domain job will be configured to disable injection of the Istio sidecar. |
| 125 | + |
| 126 | +Additionally, the operator will adjust its behavior as follows when the experimental |
| 127 | +Istio support is enabled for a domain: |
| 128 | + |
| 129 | +* The operator will ensure that the Istio sidecar is not injected into the introspector |
| 130 | + job's pods. |
| 131 | + |
| 132 | +### Exposing applications in Istio-enabled domains |
| 133 | + |
| 134 | +When a domain is running with the experimental Istio support, you should use the Istio |
| 135 | +gateway to provide external access to applications, instead of using an Ingress |
| 136 | +controller like Traefik. Using the Istio gateway will enable you to view the |
| 137 | +traffic in Kiali and to use distributed tracing all the way from the entry point to |
| 138 | +the cluster, i.e. the Istio gateway. |
| 139 | + |
| 140 | +To configure external access to your domain, you need to create an Istio `gateway` and |
| 141 | +`virtualservice` as shown in the example below: |
| 142 | + |
| 143 | +``` |
| 144 | +--- |
| 145 | +apiVersion: networking.istio.io/v1alpha3 |
| 146 | +kind: Gateway |
| 147 | +metadata: |
| 148 | + name: domain1-gateway |
| 149 | + namespace: domain1 |
| 150 | +spec: |
| 151 | + selector: |
| 152 | + istio: ingressgateway |
| 153 | + servers: |
| 154 | + - hosts: |
| 155 | + - '*' |
| 156 | + port: |
| 157 | + name: http |
| 158 | + number: 80 |
| 159 | + protocol: HTTP |
| 160 | +--- |
| 161 | +apiVersion: networking.istio.io/v1alpha3 |
| 162 | +kind: VirtualService |
| 163 | +metadata: |
| 164 | + name: domain1-virtualservice |
| 165 | + namespace: domain1 |
| 166 | +spec: |
| 167 | + gateways: |
| 168 | + - domain1-gateway |
| 169 | + hosts: |
| 170 | + - '*' |
| 171 | + http: |
| 172 | + - match: |
| 173 | + - uri: |
| 174 | + prefix: / |
| 175 | + - port: 8001 |
| 176 | + route: |
| 177 | + - destination: |
| 178 | + host: domain1-cluster-cluster-1.domain1.svc.cluster.local |
| 179 | + port: |
| 180 | + number: 8001 |
| 181 | +``` |
| 182 | + |
| 183 | +This example creates a gateway that will accept requests with any host name |
| 184 | +using HTTP on port 80, and a virtual service that will route all of |
| 185 | +those requests to the cluster service for `cluster-1` in `domain1` in |
| 186 | +the namespace `domain1`. |
| 187 | + |
| 188 | +Please refer to the [Istio documentation](https://istio.io/docs/tasks/traffic-management/ingress/) |
| 189 | +for more information about providing ingress using Istio. |
| 190 | + |
| 191 | +### Traffic management |
| 192 | + |
| 193 | +Istio provides traffic management capabilities, including the ability to |
| 194 | +visualize traffic in Kiali. You do not need to change your applications to use |
| 195 | +this feature. The Istio proxy (envoy) sidecar that is injected into your pods |
| 196 | +provides this visibility. The experimental Istio support does enable |
| 197 | +traffic management. The image below shows an example with traffic |
| 198 | +flowing: |
| 199 | + |
| 200 | +* In from the Istio gateway on the left. |
| 201 | +* To a domain called "bobbys-front-end". |
| 202 | +* To a non-WebLogic application, in this case a Helidon microservice |
| 203 | + called "bobbys-helidon-stock-application". |
| 204 | +* To a second domain called "bobs-bookstore". |
| 205 | + |
| 206 | +In this example you can see how the traffic flows to the cluster services and |
| 207 | +then to the individual managed servers. |
| 208 | + |
| 209 | + |
| 210 | + |
| 211 | +You can learn more about [Istio traffic management](https://istio.io/docs/concepts/traffic-management/) |
| 212 | +in their documentation. |
| 213 | + |
| 214 | +### Distributed tracing |
| 215 | + |
| 216 | +Istio provides distributed tracing capabilities, including the ability to view |
| 217 | +traces in Jaeger. In order to use distributed tracing though, you will need to |
| 218 | +instrument your WebLogic application first, for example, using the |
| 219 | +[Jaeger Java client](https://github.com/jaegertracing/jaeger-client-java). |
| 220 | +The image below shows an example of a distributed trace |
| 221 | +that shows a transaction following the same path through the system |
| 222 | +as shown in the image above. |
| 223 | + |
| 224 | + |
| 225 | + |
| 226 | +You can learn more about [distrubting tracing in Istio](https://istio.io/docs/tasks/telemetry/distributed-tracing/) |
| 227 | +in their documentation. |
| 228 | + |
0 commit comments