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 all 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.
154 changes: 154 additions & 0 deletions catalog/istio-stack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# istio-stack

This stack made it easier to setup a service mesh with [istio](https://istio.io/latest/),
using the the [official provided charts](https://artifacthub.io/packages/search?ts_query_web=istio&official=true&sort=relevance&page=1).

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

### Basic 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
```

### Setup with GKE

This will set up the base istio and additionally add some google specific annotations to the ingress gateway.

```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/gke"
prune: true
wait: true
```

### 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).

### Setup mutual TLS

To setup [Istio mutual TLS](https://istio.io/latest/docs/tasks/security/authentication/mtls-migration/) in a namespace,
a destination rule like below needs to be defined.

```yaml
---
apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: istio-mtls
namespace: apps
spec:
host: "*.apps.svc.cluster.local"
trafficPolicy:
tls:
mode: ISTIO_MUTUAL
```

In this example, the `apps` namespace is targeted.

### 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
# The prometheus-operator is required for visualization
- name: kube-prometheus-stack
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
17 changes: 17 additions & 0 deletions catalog/istio-stack/gke/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: istio-system
resources:
- ../base
patches:
- target:
kind: HelmRelease
name: istio-ingressgateway
namespace: istio-system
patch: |-
- op: add
path: /spec/values/service/annotations
value:
cloud.google.com/backend-config: '{"default": "backend-config"}'
cloud.google.com/neg: '{"ingress": true}'
7 changes: 7 additions & 0 deletions catalog/istio-stack/kiali/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
50 changes: 50 additions & 0 deletions catalog/istio-stack/kiali/releases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: kiali-operator
namespace: istio-system
spec:
interval: 10m0s
chart:
spec:
chart: kiali-operator
version: "1.63.1"
sourceRef:
kind: HelmRepository
name: kiali
interval: 1m
install:
crds: CreateReplace
upgrade:
crds: CreateReplace
values:
onlyViewOnlyMode: true
watchNamespace: ""

# For what a Kiali CR spec can look like, see:
# https://github.com/kiali/kiali-operator/blob/master/crd-docs/cr/kiali.io_v1alpha1_kiali.yaml
cr:
create: true
name: kiali-operator
namespace: "istio-system"
spec:
installation_tag: "Kiali - View Only"
istio_namespace: "istio-system"
auth:
strategy: "anonymous"
deployment:
accessible_namespaces:
- '**'
view_only_mode: true
instance_name: "kiali"
external_services:
custom_dashboards:
enabled: true
is_core: false
grafana:
Copy link

Choose a reason for hiding this comment

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

but probably extract the two urls in postBuild.subsitution to make it easy to override?
can one kustomization override the postBuild.subsitutions of another?

Copy link
Owner

Choose a reason for hiding this comment

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

good question, but you could also just patch the helmrelease via kustomize

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

can one kustomization override the postBuild.subsitutions of another?

not sure, but probably not.
maybe we can take out these specific urls and let the user override them according to their setup?

Copy link

Choose a reason for hiding this comment

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

sure ;) postBuild.substitutions just would be simpler - but I also guess it won't work.

Copy link
Owner

Choose a reason for hiding this comment

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

if i want to overwrite something, I patch the HelmRelease

url: "http://kube-prometheus-stack-grafana.monitoring.svc.cluster.local"
kharf marked this conversation as resolved.
Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

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

Suggested change
url: "http://kube-prometheus-stack-grafana.monitoring.svc.cluster.local"
url: "http://prometheus-operator-grafana.monitoring.svc.cluster.local"

prometheus:
url: "http://kube-prometheus-stack-operator.monitoring.svc.cluster.local:9090"
Copy link

Choose a reason for hiding this comment

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

Suggested change
url: "http://kube-prometheus-stack-operator.monitoring.svc.cluster.local:9090"
url: "http://prometheus-operated.monitoring.svc.cluster.local:9090"

Copy link
Owner

Choose a reason for hiding this comment

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

for me kube-prometheus-stack-operator is the one, when kube-prometheus-stack is is in use. Currently we only have the kube-prometheus-stack in the catalog

server:
web_root: "/kiali"
9 changes: 9 additions & 0 deletions catalog/istio-stack/kiali/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: kiali
namespace: istio-system
spec:
interval: 1h0m0s
url: https://kiali.org/helm-charts
6 changes: 6 additions & 0 deletions catalog/istio-stack/namespace/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: istio-system
resources:
- namespaces.yaml
7 changes: 7 additions & 0 deletions catalog/istio-stack/namespace/namespaces.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
kind: Namespace
apiVersion: v1
metadata:
name: istio-system
labels:
istio-operator-managed: Reconcile