-
Notifications
You must be signed in to change notification settings - Fork 1
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
Changes from all commits
3b6761f
cdbafb8
6fe9415
893ec64
d7d3c8f
ae57429
7d087c0
2b2abab
3e2734c
5a85e8b
f495f7d
92bd54e
ba37255
e441916
a2dbc1e
5b942c4
8073891
cd059a5
5be7e2f
112603c
a01ee5f
f148114
c467229
4711588
4475955
ad0b6e2
288dc4f
73b524c
cf2b9ce
29b7e0e
ff89734
3cd0269
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
``` |
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 |
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" |
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 |
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}' |
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 |
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: | ||||||
url: "http://kube-prometheus-stack-grafana.monitoring.svc.cluster.local" | ||||||
kharf marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
prometheus: | ||||||
url: "http://kube-prometheus-stack-operator.monitoring.svc.cluster.local:9090" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" |
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 |
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 |
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure, but probably not.
maybe we can take out these specific urls and let the user override them according to their setup?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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