|
| 1 | +--- |
| 2 | +title: Istio Integration |
| 3 | +weight: 200 |
| 4 | +--- |
| 5 | + |
| 6 | +# Istio Integration with Koperator |
| 7 | + |
| 8 | +Koperator now supports Istio integration using standard Istio resources, providing advanced service mesh capabilities for Kafka clusters. This integration replaces the deprecated banzaicloud istio-operator with a more robust approach using standard Kubernetes and Istio resources. |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +The Istio integration in Koperator provides: |
| 13 | + |
| 14 | +- **Service Mesh Capabilities**: Full Istio service mesh integration for Kafka clusters |
| 15 | +- **Traffic Management**: Advanced traffic routing and load balancing |
| 16 | +- **Security**: mTLS encryption and authentication |
| 17 | +- **Observability**: Enhanced monitoring and tracing capabilities |
| 18 | +- **Gateway Management**: Automatic Istio Gateway and VirtualService creation |
| 19 | +- **No Control Plane Dependency**: Works with any Istio installation |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +Before using Istio integration with Koperator, ensure you have: |
| 24 | + |
| 25 | +1. **Istio Installation**: Any Istio installation (operator-based or manual) |
| 26 | +2. **Kubernetes Cluster**: Version 1.19+ with sufficient resources |
| 27 | +3. **Istio CRDs**: Istio Custom Resource Definitions installed |
| 28 | + |
| 29 | +## Installation |
| 30 | + |
| 31 | +### 1. Install Istio (Optional) |
| 32 | + |
| 33 | +If you don't have Istio installed, you can install it using any method: |
| 34 | + |
| 35 | +```bash |
| 36 | +# Option 1: Using Istio operator |
| 37 | +kubectl apply -f https://github.com/istio/istio/releases/download/1.19.0/istio-1.19.0-linux-amd64.tar.gz |
| 38 | +istioctl install --set values.defaultRevision=default |
| 39 | + |
| 40 | +# Option 2: Using Helm |
| 41 | +helm repo add istio https://istio-release.storage.googleapis.com/charts |
| 42 | +helm repo update |
| 43 | +helm install istio-base istio/base -n istio-system --create-namespace |
| 44 | +helm install istiod istio/istiod -n istio-system --wait |
| 45 | +``` |
| 46 | + |
| 47 | +### 2. Verify Istio Installation |
| 48 | + |
| 49 | +```bash |
| 50 | +# Check Istio control plane status (if installed) |
| 51 | +kubectl get pods -n istio-system |
| 52 | + |
| 53 | +# Verify Istio CRDs are available |
| 54 | +kubectl get crd | grep istio |
| 55 | +``` |
| 56 | + |
| 57 | +## Configuration |
| 58 | + |
| 59 | +### Basic Istio Configuration |
| 60 | + |
| 61 | +Configure your KafkaCluster to use Istio ingress: |
| 62 | + |
| 63 | +```yaml |
| 64 | +apiVersion: kafka.banzaicloud.io/v1beta1 |
| 65 | +kind: KafkaCluster |
| 66 | +metadata: |
| 67 | + name: kafka |
| 68 | + namespace: kafka |
| 69 | +spec: |
| 70 | + ingressController: "istioingress" |
| 71 | + istioIngressConfig: |
| 72 | + gatewayConfig: |
| 73 | + mode: ISTIO_MUTUAL |
| 74 | + # ... rest of your Kafka configuration |
| 75 | +``` |
| 76 | + |
| 77 | +**Note**: The `istioControlPlane` configuration is no longer required as Koperator now creates standard Kubernetes resources that work with any Istio installation. |
| 78 | + |
| 79 | +### Advanced Configuration Options |
| 80 | + |
| 81 | +#### Istio Ingress Configuration |
| 82 | + |
| 83 | +```yaml |
| 84 | +spec: |
| 85 | + istioIngressConfig: |
| 86 | + # Gateway configuration |
| 87 | + gatewayConfig: |
| 88 | + mode: ISTIO_MUTUAL # or SIMPLE for non-mTLS |
| 89 | + |
| 90 | + # Resource limits and requests |
| 91 | + resources: |
| 92 | + requests: |
| 93 | + cpu: "100m" |
| 94 | + memory: "128Mi" |
| 95 | + limits: |
| 96 | + cpu: "2000m" |
| 97 | + memory: "1024Mi" |
| 98 | + |
| 99 | + # Replica configuration |
| 100 | + replicas: 2 |
| 101 | + |
| 102 | + # Node selector for gateway placement |
| 103 | + nodeSelector: |
| 104 | + kubernetes.io/os: linux |
| 105 | + |
| 106 | + # Tolerations for gateway scheduling |
| 107 | + tolerations: |
| 108 | + - key: "istio" |
| 109 | + operator: "Equal" |
| 110 | + value: "true" |
| 111 | + effect: "NoSchedule" |
| 112 | + |
| 113 | + # Environment variables |
| 114 | + envs: |
| 115 | + - name: CUSTOM_VAR |
| 116 | + value: "custom-value" |
| 117 | + |
| 118 | + # Annotations for the gateway |
| 119 | + annotations: |
| 120 | + custom.annotation: "value" |
| 121 | + |
| 122 | + # Service annotations |
| 123 | + serviceAnnotations: |
| 124 | + service.beta.kubernetes.io/aws-load-balancer-type: "nlb" |
| 125 | +``` |
| 126 | +
|
| 127 | +## Architecture Changes |
| 128 | +
|
| 129 | +### Previous Architecture (banzaicloud istio-operator) |
| 130 | +
|
| 131 | +The previous implementation used: |
| 132 | +- `IstioMeshGateway` custom resources |
| 133 | +- banzaicloud istio-operator dependencies |
| 134 | +- Custom Istio operator APIs |
| 135 | + |
| 136 | +### New Architecture (Standard Istio Resources) |
| 137 | + |
| 138 | +The new implementation uses: |
| 139 | +- Standard Kubernetes `Deployment` and `Service` resources |
| 140 | +- Native Istio `Gateway` and `VirtualService` resources |
| 141 | +- No dependency on specific Istio control plane or operator |
| 142 | + |
| 143 | +### Resource Creation |
| 144 | + |
| 145 | +When you create a KafkaCluster with Istio integration, Koperator automatically creates: |
| 146 | + |
| 147 | +1. **Kubernetes Deployment**: Istio proxy deployment with `docker.io/istio/proxyv2:latest` image |
| 148 | +2. **Kubernetes Service**: Load balancer service for external access |
| 149 | +3. **Istio Gateway**: Routes external traffic to Kafka brokers |
| 150 | +4. **VirtualService**: Defines routing rules for the gateway |
| 151 | + |
| 152 | +The implementation creates standard Kubernetes resources that work with any Istio installation, making it more flexible and compatible. |
| 153 | + |
| 154 | +## Security Features |
| 155 | + |
| 156 | +### mTLS Configuration |
| 157 | + |
| 158 | +The Istio integration supports mutual TLS (mTLS) for secure communication: |
| 159 | + |
| 160 | +```yaml |
| 161 | +spec: |
| 162 | + istioIngressConfig: |
| 163 | + gatewayConfig: |
| 164 | + mode: ISTIO_MUTUAL # Enables mTLS |
| 165 | +``` |
| 166 | + |
| 167 | +### Authentication and Authorization |
| 168 | + |
| 169 | +Istio provides additional security features: |
| 170 | +- **PeerAuthentication**: Configure mTLS policies |
| 171 | +- **AuthorizationPolicy**: Define access control rules |
| 172 | +- **RequestAuthentication**: JWT token validation |
| 173 | + |
| 174 | +## Monitoring and Observability |
| 175 | + |
| 176 | +### Metrics |
| 177 | + |
| 178 | +Istio integration provides enhanced metrics: |
| 179 | +- **Traffic Metrics**: Request rates, latency, error rates |
| 180 | +- **Gateway Metrics**: Istio gateway performance |
| 181 | +- **Service Mesh Metrics**: End-to-end observability |
| 182 | + |
| 183 | +### Tracing |
| 184 | + |
| 185 | +Distributed tracing is automatically enabled: |
| 186 | +- **Jaeger Integration**: Automatic trace collection |
| 187 | +- **Zipkin Support**: Alternative tracing backend |
| 188 | +- **Custom Trace Sampling**: Configurable sampling rates |
| 189 | + |
| 190 | +## Troubleshooting |
| 191 | + |
| 192 | +### Common Issues |
| 193 | + |
| 194 | +1. **Istio Control Plane Not Found** |
| 195 | + ```bash |
| 196 | + # Verify Istio control plane is running |
| 197 | + kubectl get pods -n istio-system |
| 198 | + ``` |
| 199 | + |
| 200 | +2. **Gateway Not Receiving Traffic** |
| 201 | + ```bash |
| 202 | + # Check gateway status |
| 203 | + kubectl get gateway -n kafka |
| 204 | + kubectl describe gateway kafka-gateway -n kafka |
| 205 | + ``` |
| 206 | + |
| 207 | +3. **mTLS Configuration Issues** |
| 208 | + ```bash |
| 209 | + # Verify peer authentication |
| 210 | + kubectl get peerauthentication -n kafka |
| 211 | + ``` |
| 212 | + |
| 213 | +### Debugging Commands |
| 214 | + |
| 215 | +```bash |
| 216 | +# Check Istio proxy status |
| 217 | +istioctl proxy-status |
| 218 | +
|
| 219 | +# Verify configuration |
| 220 | +istioctl analyze |
| 221 | +
|
| 222 | +# Check gateway configuration |
| 223 | +kubectl get gateway,virtualservice -n kafka |
| 224 | +
|
| 225 | +# View Istio logs |
| 226 | +kubectl logs -n kafka -l app=istio-ingressgateway |
| 227 | +``` |
| 228 | + |
| 229 | +## Migration from banzaicloud istio-operator |
| 230 | + |
| 231 | +If you're migrating from the deprecated banzaicloud istio-operator: |
| 232 | + |
| 233 | +1. **Remove old dependencies**: Uninstall banzaicloud istio-operator |
| 234 | +2. **Install upstream Istio**: Follow the installation steps above |
| 235 | +3. **Update configurations**: Update your KafkaCluster specs |
| 236 | +4. **Test thoroughly**: Verify all functionality works as expected |
| 237 | + |
| 238 | +## Best Practices |
| 239 | + |
| 240 | +1. **Resource Planning**: Allocate sufficient resources for Istio components |
| 241 | +2. **Security**: Always use mTLS in production environments |
| 242 | +3. **Monitoring**: Set up comprehensive monitoring and alerting |
| 243 | +4. **Testing**: Thoroughly test Istio configurations in non-production environments |
| 244 | +5. **Updates**: Keep Istio and Koperator versions compatible |
| 245 | + |
| 246 | +## Examples |
| 247 | + |
| 248 | +### Complete KafkaCluster with Istio |
| 249 | + |
| 250 | +```yaml |
| 251 | +apiVersion: kafka.banzaicloud.io/v1beta1 |
| 252 | +kind: KafkaCluster |
| 253 | +metadata: |
| 254 | + name: kafka |
| 255 | + namespace: kafka |
| 256 | +spec: |
| 257 | + headlessServiceEnabled: false |
| 258 | + ingressController: "istioingress" |
| 259 | + istioIngressConfig: |
| 260 | + gatewayConfig: |
| 261 | + mode: ISTIO_MUTUAL |
| 262 | + resources: |
| 263 | + requests: |
| 264 | + cpu: "100m" |
| 265 | + memory: "128Mi" |
| 266 | + limits: |
| 267 | + cpu: "2000m" |
| 268 | + memory: "1024Mi" |
| 269 | + replicas: 2 |
| 270 | + annotations: |
| 271 | + sidecar.istio.io/inject: "true" |
| 272 | + zkAddresses: |
| 273 | + - "zookeeper-server-client.zookeeper:2181" |
| 274 | + clusterImage: "ghcr.io/adobe/koperator/kafka:2.13-3.9.1" |
| 275 | + brokers: |
| 276 | + - id: 0 |
| 277 | + brokerConfigGroup: "default" |
| 278 | + - id: 1 |
| 279 | + brokerConfigGroup: "default" |
| 280 | + - id: 2 |
| 281 | + brokerConfigGroup: "default" |
| 282 | + brokerConfigGroups: |
| 283 | + default: |
| 284 | + storageConfigs: |
| 285 | + - mountPath: "/kafka-logs" |
| 286 | + pvcSpec: |
| 287 | + accessModes: |
| 288 | + - ReadWriteOnce |
| 289 | + resources: |
| 290 | + requests: |
| 291 | + storage: 10Gi |
| 292 | + listenersConfig: |
| 293 | + internalListeners: |
| 294 | + - type: "plaintext" |
| 295 | + name: "internal" |
| 296 | + containerPort: 29092 |
| 297 | + usedForInnerBrokerCommunication: true |
| 298 | + externalListeners: |
| 299 | + - type: "plaintext" |
| 300 | + name: "external" |
| 301 | + externalStartingPort: 19090 |
| 302 | + containerPort: 9094 |
| 303 | +``` |
| 304 | + |
| 305 | +## Support |
| 306 | + |
| 307 | +For issues related to Istio integration: |
| 308 | + |
| 309 | +1. **Koperator Issues**: Report to the Koperator GitHub repository |
| 310 | +2. **Istio Issues**: Report to the Istio GitHub repository |
| 311 | +3. **Documentation**: Check the official Istio documentation |
| 312 | +4. **Community**: Join the Istio and Koperator community discussions |
0 commit comments