Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(catalog): Add istio-stack #110

Merged
merged 32 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3b6761f
feat(catalog): Add istio-stack
beiertu-mms Jan 31, 2023
cdbafb8
feat: Set up istio with default values
beiertu-mms Feb 2, 2023
6fe9415
feat: Enable istio-controlplane
beiertu-mms Feb 2, 2023
893ec64
feat: Bump istio-operator to v2.8.2
beiertu-mms Feb 2, 2023
d7d3c8f
feat: Enable serviceMonitor
beiertu-mms Feb 2, 2023
ae57429
feat: Remove serviceMonitor and dashboards configs
beiertu-mms Feb 2, 2023
7d087c0
docs: Update readme
beiertu-mms Feb 2, 2023
2b2abab
feat: Update readme and kiali version
beiertu-mms Feb 2, 2023
3e2734c
feat: Adjust prometheus settings for istio
beiertu-mms Feb 3, 2023
5a85e8b
feat: Align istio releases
beiertu-mms Feb 3, 2023
f495f7d
feat: Set resources & annotations for egressgateway
beiertu-mms Feb 13, 2023
92bd54e
feat: Add Reconcile label to istio namespace
beiertu-mms Feb 13, 2023
ba37255
docs: Update main readme
beiertu-mms Feb 14, 2023
e441916
docs: Add link to kube-prometheus-stack
beiertu-mms Feb 16, 2023
a2dbc1e
feat: switch to official charts
beiertu-mms Feb 22, 2023
5b942c4
feat: change HelmRepository to GitRepository
beiertu-mms Feb 22, 2023
8073891
feat: set up istio from official charts
beiertu-mms Feb 22, 2023
cd059a5
feat: define istiod, ingress- and egress values
beiertu-mms Mar 6, 2023
5be7e2f
fix: change istio-ingressgateway type to LoadBalancer
beiertu-mms Mar 6, 2023
112603c
feat: substitute istio version post build
beiertu-mms Mar 6, 2023
a01ee5f
Revert "feat: substitute istio version post build"
beiertu-mms Mar 6, 2023
f148114
feat: set min pod count for istiod and gateways
beiertu-mms Mar 6, 2023
c467229
feat: bump to v1.17.1
beiertu-mms Mar 6, 2023
4711588
feat: use default scaling
beiertu-mms Mar 6, 2023
4475955
feat: move google specific to gke
beiertu-mms Mar 6, 2023
ad0b6e2
feat: remove config folder
beiertu-mms Mar 8, 2023
288dc4f
fix: adjust patch for istio-ingressgateway
beiertu-mms Mar 8, 2023
73b524c
feat: add service entries and destination rules to gke
beiertu-mms Mar 8, 2023
cf2b9ce
docs: add description to gke setup
beiertu-mms Mar 8, 2023
29b7e0e
feat: remove apps specifics setup
beiertu-mms Mar 8, 2023
ff89734
feat: add simple setup with gke
beiertu-mms Mar 8, 2023
3cd0269
docs: update istio charts link
beiertu-mms Mar 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ You're ready to browse the [catalog](#catalog).
- [keda](./catalog/keda) - Keda is a Kubernetes based Event Driven Autoscaler. With KEDA, you can drive the scaling of any container in Kubernetes based on the number of events needing to be processed
- [kyverno](./catalog/kyverno) - Kyverno is a policy engine designed for Kubernetes.
- [ingress-nginx](./catalog/ingress-nginx) - Ingress-Nginx is an Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer.
- [istio-stack](./catalog/istio-stack) - Istio is a service mesh for Kubernetes. It provides secure service-to-service communication, automatic load balancing, fine-grained control of traffic behavior and more.
129 changes: 129 additions & 0 deletions catalog/istio-stack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# istio-stack

This stack made it easier to setup a service mesh with [istio](https://istio.io/latest/).
It provides the setup for [istio-operator](https://github.com/stevehipwell/helm-charts/tree/master/charts/istio-operator) with sensible defaults
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, didnt see it before. I think this link is not the correct anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjust this sentence

and also provides optional configurations for destination rules and service entries.
Furthermore [Kiali](https://kiali.io/) with a preconfigured [Kiali-operator](https://github.com/kiali/helm-charts/tree/master/kiali-operator)
can be setup as well for configuring, visualizing, validating and troubleshooting your service mesh.

## Usage

### Setup

To use this stack you have to apply 2 configurations (and the GitRepository source):

```yaml
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: istio-stack-namespace
namespace: flux-system
spec:
interval: 10m
retryInterval: 1m0s
sourceRef:
kind: GitRepository
name: flux-k8s-stack
path: "./catalog/istio-stack/namespace"
prune: true
wait: true
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: istio-system
namespace: flux-system
spec:
interval: 10m
retryInterval: 1m0s
dependsOn:
- name: istio-stack-namespace
sourceRef:
kind: GitRepository
name: flux-k8s-stack
path: "./catalog/istio-stack/base"
prune: true
wait: true
```

### Configuration

The catalog also provides default configuration. This configuration is optional, and can be omitted but is recommended.
To use the configuration, apply this Kustomization via GitOps

```yaml
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: istio-config
namespace: flux-system
spec:
interval: 10m
retryInterval: 1m0s
sourceRef:
kind: GitRepository
name: flux-k8s-stack
path: "./catalog/istio-stack/config"
dependsOn:
# Please make sure the apps namespace is created
- name: apps
namespace: flux-system
# This dependency is required to make sure the operator is deployed before the config is applied
- name: istio-system
namespace: flux-system
prune: true
wait: true
```

The configuration targets the `apps` namespace, so make sure that it's created before using the provided configuration.
Or alternatively you can copy and customize the rules in your own GitOps repository's config folder as needed.

### Sidecar injection

Istio sidecar can be injected [automatically](https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/#automatic-sidecar-injection)
or [manually](https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/#manual-sidecar-injection)
or [via a custom injection template](https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/#customizing-injection).

### Kiali

To use Kiali, you have to apply the following configuration (and the GitRepository source):

```yaml
---
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
name: kiali
namespace: flux-system
spec:
interval: 10m
retryInterval: 1m0s
sourceRef:
kind: GitRepository
name: flux-k8s-stack
path: "./catalog/istio-stack/kiali"
dependsOn:
# istio system is a hard dependency
- name: istio-system
namespace: flux-system
# The prometheus-operator is required for visualization
- name: kube-prometheus-stack
namespace: flux-system
prune: true
wait: true
healthChecks:
- kind: Deployment
name: kiali
namespace: istio-system
```

Make sure to set up `grafana` and `prometheus` via [kube-prometheus-stack](./../kube-prometheus-stack/README.md)
before hand in your cluster for Kiali's visualization to work correctly.

The Kiali UI can be accessed via a port-forward on port 20001:

```sh
kubectl port-forward services/kiali --namespace istio-system 20001
```
7 changes: 7 additions & 0 deletions catalog/istio-stack/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: istio-system
resources:
- repositories.yaml
- releases.yaml
116 changes: 116 additions & 0 deletions catalog/istio-stack/base/releases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
################################################################################
# Base
################################################################################
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: istio-base
namespace: istio-system
spec:
interval: 10m0s
chart:
spec:
version: "1.17.1"
chart: base
sourceRef:
kind: HelmRepository
name: istio
interval: 1m
install:
crds: CreateReplace
upgrade:
crds: CreateReplace
---
################################################################################
# Istiod
################################################################################
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: istiod
namespace: istio-system
spec:
dependsOn:
- name: istio-base
namespace: istio-system
interval: 10m0s
chart:
spec:
version: "1.17.1"
chart: istiod
sourceRef:
kind: HelmRepository
name: istio
interval: 1m
values:
global:
istioNamespace: istio-system
proxy:
resources:
requests:
cpu: 10m
memory: 16Mi
pilot:
resources:
requests:
cpu: 100m
memory: 500Mi
---
################################################################################
# Ingress Gateways
################################################################################
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: istio-ingressgateway
namespace: istio-system
spec:
dependsOn:
- name: istio-base
namespace: istio-system
- name: istiod
namespace: istio-system
interval: 10m0s
chart:
spec:
version: "1.17.1"
chart: gateway
sourceRef:
kind: HelmRepository
name: istio
values:
name: istio-ingressgateway
service:
type: LoadBalancer
podAnnotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
---
################################################################################
# Egress Gateways
################################################################################
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: istio-egressgateway
namespace: istio-system
spec:
dependsOn:
- name: istio-base
namespace: istio-system
- name: istiod
namespace: istio-system
interval: 10m0s
chart:
spec:
version: "1.17.1"
chart: gateway
sourceRef:
kind: HelmRepository
name: istio
values:
name: istio-egressgateway
service:
type: ClusterIP
podAnnotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
9 changes: 9 additions & 0 deletions catalog/istio-stack/base/repositories.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta1
kind: HelmRepository
metadata:
name: istio
namespace: istio-system
spec:
interval: 1h0m0s
url: https://istio-release.storage.googleapis.com/charts
78 changes: 78 additions & 0 deletions catalog/istio-stack/config/destinationrules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
################################################################################
# Istio mTLS between Apps
################################################################################
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: istio-apps-mtls
namespace: apps
spec:
host: "*.apps.svc.cluster.local"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is apps? What if the customer doesn't have an apps namespace? Imo this is user specific configuration whcih you can't foresee

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it can be removed and a howto on the readme can be added for enabling this feature?

Copy link
Owner

@kharf kharf Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we shouldn't do it at all. This too opinionated. We just provide preconfiguration for istio based on where its running, but not how they should define their ingress/egress

trafficPolicy:
tls:
mode: ISTIO_MUTUAL
---
################################################################################
# Google Destination Rules
################################################################################
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: dr-google-storage-api
namespace: apps
spec:
host: storage.googleapis.com
beiertu-mms marked this conversation as resolved.
Show resolved Hide resolved
trafficPolicy:
portLevelSettings:
- port:
number: 80
tls:
mode: SIMPLE # initiates HTTPS
---
################################################################################
# Prometheus
################################################################################
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: prometheus-stack-grafana
namespace: apps
spec:
host: kube-prometheus-stack-grafana.monitoring.svc.cluster.local
trafficPolicy:
tls:
mode: DISABLE
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: prometheus-stack-prometheus
namespace: apps
spec:
host: kube-prometheus-stack-operator.monitoring.svc.cluster.local
trafficPolicy:
tls:
mode: DISABLE
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: prometheus-stack-alertmanager
namespace: apps
spec:
host: kube-prometheus-stack-alertmanager.monitoring.svc.cluster.local
trafficPolicy:
tls:
mode: DISABLE
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: prometheus-pushgateway
namespace: apps
spec:
host: prometheus-pushgateway.monitoring.svc.cluster.local
trafficPolicy:
tls:
mode: DISABLE
6 changes: 6 additions & 0 deletions catalog/istio-stack/config/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- destinationrules.yaml
- serviceentries.yaml
Loading