Update examples

This commit is contained in:
Darren Shepherd
2020-09-15 22:35:41 -07:00
parent 556d18c26b
commit 4eff05a5c2
153 changed files with 24853 additions and 120 deletions

View File

@@ -1,12 +1,29 @@
# Fleet Examples # Fleet Examples
This repository contains examples of how to use Fleet using different approaches. This repository contains examples of how to use Fleet using different approaches.
The repo is broken up into two different sections: Single cluster and Multi Cluster.
## Single Cluster Examples
All examples will deploy content to the local cluster running the Fleet Manager.
| Example | Description | | Example | Description |
|-------------|-------------| |-------------|-------------|
| [simple](simple/) | The minimally viable repo to deploy raw Kubernetes resources | | [manifest](single-cluster/manifest/) | A full example of using raw Kubernetes YAML and customizing it per target cluster |
| [manifest](manifest/) | A full example of using raw Kubernetes YAML and customizing it per target cluster | | [helm](single-cluster/helm/) | A full example of using Helm and customizing it per target cluster |
| [helm](helm/) | A full example of using Helm and customizing it per target cluster | | [helm-external](single-cluster/helm-external/) | A full example of using a Helm chart that is downloaded from a third party source and customizing it per target cluster |
| [helm-external](helm-external/) | A full example of using a Helm chart that is downloaded from a third party source and customizing it per target cluster | | [kustomize](single-cluster/kustomize/) | A full example of using Kustomize and customizing it per target cluster |
| [kustomize](kustomize/) | A full example of using Kustomize and customizing it per target cluster | | [helm-kustomize](single-cluster/helm-kustomize/) | A full example of using Kustomize to modify a third party Helm chart |
| [helm-kustomize](helm-kustomize/) | A full example of using Kustomize to modify a third party Helm chart |
## Multi-Cluster Examples
The examples below will deploy a single git repo to multiple clusters at once
and configure the app differently for each target.
| Example | Description |
|-------------|-------------|
| [manifest](multi-cluster/manifest/) | A full example of using raw Kubernetes YAML and customizing it per target cluster |
| [helm](multi-cluster/helm/) | A full example of using Helm and customizing it per target cluster |
| [helm-external](multi-cluster/helm-external/) | A full example of using a Helm chart that is downloaded from a third party source and customizing it per target cluster |
| [kustomize](multi-cluster/kustomize/) | A full example of using Kustomize and customizing it per target cluster |
| [helm-kustomize](multi-cluster/helm-kustomize/) | A full example of using Kustomize to modify a third party Helm chart |

View File

@@ -1,24 +0,0 @@
namespace: fleet-helm-external-example
chart: https://github.com/rancher/fleet-examples/releases/download/example/guestbook-0.0.0.tgz
targets:
- name: dev
values:
replication: false
clusterSelector:
matchLabels:
env: dev
- name: test
values:
replicas: 3
clusterSelector:
matchLabels:
env: test
- name: prod
values:
serviceType: LoadBalancer
replicas: 3
clusterSelector:
matchLabels:
env: prod

View File

@@ -1,23 +0,0 @@
namespace: fleet-helm-kustomize-example
chart: https://github.com/rancher/fleet-examples/releases/download/example/guestbook-0.0.0.tgz
targets:
- name: dev
clusterSelector:
matchLabels:
env: dev
# NOTE: This directory is always relative to ./kustomize
kustomizeDir: overlays/dev
- name: test
clusterSelector:
matchLabels:
env: test
# NOTE: This directory is always relative to ./kustomize
kustomizeDir: overlays/test
- name: prod
clusterSelector:
matchLabels:
env: prod
# NOTE: This directory is always relative to ./kustomize
kustomizeDir: overlays/prod

View File

@@ -1,22 +0,0 @@
namespace: fleet-kustomize-example
targets:
- name: dev
clusterSelector:
matchLabels:
env: dev
# NOTE: This directory is always relative to ./kustomize
kustomizeDir: overlays/dev
- name: test
clusterSelector:
matchLabels:
env: test
# NOTE: This directory is always relative to ./kustomize
kustomizeDir: overlays/test
- name: prod
clusterSelector:
matchLabels:
env: prod
# NOTE: This directory is always relative to ./kustomize
kustomizeDir: overlays/prod

View File

@@ -1,23 +0,0 @@
namespace: fleet-manifest-example
targets:
- name: dev
clusterSelector:
matchLabels:
env: dev
overlays:
- noreplication
- name: test
clusterSelector:
matchLabels:
env: test
overlays:
- scale3
- name: prod
clusterSelector:
matchLabels:
env: prod
overlays:
- servicelb
- scale3

View File

@@ -2,7 +2,7 @@
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as
packaged as a Helm chart downloaded from a third party source. packaged as a Helm chart downloaded from a third party source.
The app will be deployed into the `fleet-helm-external-example` namespace. The app will be deployed into the `fleet-mc-helm-external-example` namespace.
The application will be customized as follows per environment: The application will be customized as follows per environment:
@@ -18,9 +18,9 @@ metadata:
namespace: fleet-local namespace: fleet-local
spec: spec:
repo: https://github.com/rancher/fleet-examples/ repo: https://github.com/rancher/fleet-examples/
bundleDirs: paths:
- helm-external - helm-external
targets: targetCustomizations:
- name: dev - name: dev
clusterSelector: clusterSelector:
matchLabels: matchLabels:

View File

@@ -0,0 +1,28 @@
namespace: fleet-mc-helm-external-example
helm:
chart: https://github.com/rancher/fleet-examples/releases/download/example/guestbook-0.0.0.tgz
targets:
- name: dev
helm:
values:
replication: false
clusterSelector:
matchLabels:
env: dev
- name: test
helm:
values:
replicas: 3
clusterSelector:
matchLabels:
env: test
- name: prod
helm:
values:
serviceType: LoadBalancer
replicas: 3
clusterSelector:
matchLabels:
env: prod

View File

@@ -2,7 +2,7 @@
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as
packaged as a Helm chart downloaded from a third party source and will modify the helm chart using Kustomize. packaged as a Helm chart downloaded from a third party source and will modify the helm chart using Kustomize.
The app will be deployed into the `fleet-helm-kustomize-example` namespace. The app will be deployed into the `fleet-mc-helm-kustomize-example` namespace.
The application will be customized as follows per environment: The application will be customized as follows per environment:
@@ -18,9 +18,9 @@ metadata:
namespace: fleet-local namespace: fleet-local
spec: spec:
repo: https://github.com/rancher/fleet-examples/ repo: https://github.com/rancher/fleet-examples/
bundleDirs: paths:
- helm-kustomize - helm-kustomize
targets: targetCustomizations:
- name: dev - name: dev
clusterSelector: clusterSelector:
matchLabels: matchLabels:

View File

@@ -0,0 +1,24 @@
namespace: fleet-mc-helm-kustomize-example
helm:
chart: https://github.com/rancher/fleet-examples/releases/download/example/guestbook-0.0.0.tgz
targets:
- name: dev
clusterSelector:
matchLabels:
env: dev
kustomize:
dir: overlays/dev
- name: test
clusterSelector:
matchLabels:
env: test
kustomize:
dir: overlays/test
- name: prod
clusterSelector:
matchLabels:
env: prod
kustomize:
dir: overlays/prod

View File

@@ -2,7 +2,7 @@
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as
packaged as a Helm chart. packaged as a Helm chart.
The app will be deployed into the `fleet-helm-example` namespace. The app will be deployed into the `fleet-mc-helm-example` namespace.
The application will be customized as follows per environment: The application will be customized as follows per environment:
@@ -18,9 +18,9 @@ metadata:
namespace: fleet-local namespace: fleet-local
spec: spec:
repo: https://github.com/rancher/fleet-examples/ repo: https://github.com/rancher/fleet-examples/
bundleDirs: paths:
- helm - helm
targets: targetCustomizations:
- name: dev - name: dev
clusterSelector: clusterSelector:
matchLabels: matchLabels:

View File

@@ -0,0 +1,26 @@
namespace: fleet-mc-helm-example
targetCustomizations:
- name: dev
helm:
values:
replication: false
clusterSelector:
matchLabels:
env: dev
- name: test
helm:
values:
replicas: 3
clusterSelector:
matchLabels:
env: test
- name: prod
helm:
values:
serviceType: LoadBalancer
replicas: 3
clusterSelector:
matchLabels:
env: prod

View File

@@ -1,7 +1,7 @@
# Helm Example # Helm Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application
using kustomize. The app will be deployed into the `fleet-kustomize-example` namespace. using kustomize. The app will be deployed into the `fleet-mc-kustomize-example` namespace.
The application will be customized as follows per environment: The application will be customized as follows per environment:
@@ -19,7 +19,7 @@ spec:
repo: https://github.com/rancher/fleet-examples/ repo: https://github.com/rancher/fleet-examples/
bundleDirs: bundleDirs:
- kustomize - kustomize
targets: targetCustomization:
- name: dev - name: dev
clusterSelector: clusterSelector:
matchLabels: matchLabels:

View File

@@ -1,23 +1,22 @@
namespace: fleet-helm-example namespace: fleet-mc-kustomize-example
targets: targets:
- name: dev - name: dev
values:
replication: false
clusterSelector: clusterSelector:
matchLabels: matchLabels:
env: dev env: dev
kustomize:
dir: overlays/dev
- name: test - name: test
values:
replicas: 3
clusterSelector: clusterSelector:
matchLabels: matchLabels:
env: test env: test
kustomize:
dir: overlays/test
- name: prod - name: prod
values:
serviceType: LoadBalancer
replicas: 3
clusterSelector: clusterSelector:
matchLabels: matchLabels:
env: prod env: prod
kustomize:
dir: overlays/prod

View File

@@ -1,7 +1,7 @@
# Manifests Example # Manifests Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application. This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application.
The app will be deployed into the `fleet-manifest-example` namespace. The app will be deployed into the `fleet-mc-manifest-example` namespace.
The application will be customized as follows per environment: The application will be customized as follows per environment:
@@ -19,7 +19,7 @@ spec:
repo: https://github.com/rancher/fleet-examples/ repo: https://github.com/rancher/fleet-examples/
bundleDirs: bundleDirs:
- manifests - manifests
targets: targetCustomizations:
- name: dev - name: dev
clusterSelector: clusterSelector:
matchLabels: matchLabels:

View File

@@ -0,0 +1,29 @@
namespace: fleet-mc-manifest-example
targets:
- name: dev
clusterSelector:
matchLabels:
env: dev
yaml:
overlays:
# Refers to overlays/noreplication folder
- noreplication
- name: test
clusterSelector:
matchLabels:
env: test
yaml:
overlays:
# Refers to overlays/scale3 folder
- scale3
- name: prod
clusterSelector:
matchLabels:
env: prod
yaml:
# Refers to overlays/servicelb, scale3 folders
overlays:
- servicelb
- scale3

View File

@@ -11,6 +11,6 @@ metadata:
namespace: fleet-local namespace: fleet-local
spec: spec:
repo: https://github.com/rancher/fleet-examples/ repo: https://github.com/rancher/fleet-examples/
bundleDirs: paths:
- simple - simple
``` ```

View File

@@ -0,0 +1,17 @@
# Helm Kustomize Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as
packaged as a Helm chart downloaded from a third party source and will modify the helm chart using Kustomize.
The app will be deployed into the `fleet-helm-kustomize-example` namespace.
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: helm-kustomize
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples/
paths:
- helm-kustomize
```

View File

@@ -0,0 +1,10 @@
# This file and all contents in it are OPTIONAL.
#
# Refer to ../helm/fleet.yaml and ../kustomize/fleet.yaml for the full reference
# of what can be included here. All Helm and Kustomize options apply
namespace: fleet-helm-kustomize-example
helm:
chart: https://github.com/rancher/fleet-examples/releases/download/example/guestbook-0.0.0.tgz
kustomize:
dir: ./overlays/dev

View File

@@ -0,0 +1,3 @@
patches:
- redis-slave-deployment.yaml
- redis-slave-service.yaml

View File

@@ -0,0 +1,6 @@
kind: Deployment
apiVersion: apps/v1
metadata:
name: redis-slave
spec:
replicas: 0

View File

@@ -0,0 +1,7 @@
kind: Service
apiVersion: v1
metadata:
name: redis-slave
spec:
selector:
role: master

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: guestbook
description: Sample application
version: 0.0.0
appVersion: 0.0.0

View File

@@ -0,0 +1,17 @@
# Helm Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as
packaged as a Helm chart.
The app will be deployed into the `fleet-helm-example` namespace.
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: helm
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples/
paths:
- single-cluster/helm
```

View File

@@ -0,0 +1,32 @@
# This file and all contents in it are OPTIONAL.
# The namespace this chart will be installed to,
# if not specified the chart will be installed to "default"
namespace: fleet-multi-chart-helm-example
# Custom helm options
helm:
# The release name to use. If empty a generated release name will be used
releaseName: guestbook
# The directory of the chart in the repo. Also any valid go-getter supported
# URL can be used there is specify where to download the chart from.
# If repo below is set this value if the chart name in the repo
chart: ""
# An https to a valid Helm repository to download the chart from
repo: ""
# Used if repo is set to look up the version of the chart
version: ""
# Force recreate resource that can not be updated
force: false
# How long for helm to wait for the release to be active. If the value
# is less that or equal to zero, we will not wait in Helm
timeoutSeconds: 0
# Custom values that will be passed as values.yaml to the installation
values:
replicas: 2

View File

@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
selector:
matchLabels:
app: guestbook
tier: frontend
replicas: {{ .Values.replicas }}
template:
metadata:
labels:
app: guestbook
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google-samples/gb-frontend:v4
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 80

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
type: "{{ .Values.serviceType }}"
ports:
- port: 80
selector:
app: guestbook
tier: frontend

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-master
spec:
selector:
matchLabels:
app: redis
role: master
tier: backend
replicas: 1
template:
metadata:
labels:
app: redis
role: master
tier: backend
spec:
containers:
- name: master
image: redis
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: redis-master
labels:
app: redis
role: master
tier: backend
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: redis
role: master
tier: backend

View File

@@ -0,0 +1,29 @@
{{ if .Values.replication }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-slave
spec:
selector:
matchLabels:
app: redis
role: slave
tier: backend
replicas: 2
template:
metadata:
labels:
app: redis
role: slave
tier: backend
spec:
containers:
- name: slave
image: gcr.io/google_samples/gb-redisslave:v1
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379
{{ end }}

View File

@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: redis-slave
labels:
app: redis
role: slave
tier: backend
spec:
ports:
- port: 6379
selector:
app: redis
{{ if .Values.replication }}
role: slave
{{ else }}
role: master
{{ end }}
tier: backend

View File

@@ -0,0 +1,3 @@
replication: true
replicas: 1
serviceType: NodePort

View File

@@ -0,0 +1,5 @@
namespace: cattle-monitoring-system
helm:
releaseName: rancher-monitoring-crd
chart: rancher-monitoring-crd
repo: https://charts.rancher.io

View File

@@ -0,0 +1,44 @@
namespace: cattle-monitoring-system
helm:
releaseName: rancher-monitoring
repo: https://charts.rancher.io
chart: rancher-monitoring
diff:
comparePatches:
- apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
name: rancher-monitoring-admission
operations:
- {"op":"remove", "path":"/webhooks/0/failurePolicy"}
- {"op":"remove", "path":"/webhooks/0/rules/0/scope"}
- apiVersion: admissionregistration.k8s.io/v1beta1
kind: ValidatingWebhookConfiguration
name: rancher-monitoring-admission
operations:
- {"op":"remove", "path":"/webhooks/0/failurePolicy"}
- {"op":"remove", "path":"/webhooks/0/rules/0/scope"}
- apiVersion: policy/v1beta1
kind: PodSecurityPolicy
operations:
- {"op":"remove", "path":"/spec/hostIPC"}
- {"op":"remove", "path":"/spec/hostNetwork"}
- {"op":"remove", "path":"/spec/hostPID"}
- {"op":"remove", "path":"/spec/privileged"}
- {"op":"remove", "path":"/spec/readOnlyRootFilesystem"}
- apiVersion: apps/v1
kind: Deployment
name: rancher-monitoring-grafana
namespace: cattle-monitoring-system
operations:
- {"op":"remove", "path":"/spec/template/spec/containers/0/env/0/value"}
- apiVersion: apps/v1
kind: Deployment
operations:
- {"op":"remove", "path":"/spec/template/spec/hostNetwork"}
- {"op":"remove", "path":"/spec/template/spec/nodeSelector"}
- {"op":"remove", "path":"/spec/template/spec/priorityClassName"}
- {"op":"remove", "path":"/spec/template/spec/tolerations"}
- apiVersion: v1
kind: ServiceAccount
operations:
- {"op":"remove", "path":"/imagePullSecrets"}

View File

@@ -0,0 +1,5 @@
apiVersion: v2
name: guestbook
description: Sample application
version: 0.0.0
appVersion: 0.0.0

View File

@@ -0,0 +1,17 @@
# Helm Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application as
packaged as a Helm chart.
The app will be deployed into the `fleet-helm-example` namespace.
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: helm
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples/
paths:
- single-cluster/helm
```

View File

@@ -0,0 +1,32 @@
# This file and all contents in it are OPTIONAL.
# The namespace this chart will be installed to,
# if not specified the chart will be installed to "default"
namespace: fleet-helm-example
# Custom helm options
helm:
# The release name to use. If empty a generated release name will be used
releaseName: guestbook
# The directory of the chart in the repo. Also any valid go-getter supported
# URL can be used there is specify where to download the chart from.
# If repo below is set this value if the chart name in the repo
chart: ""
# An https to a valid Helm repository to download the chart from
repo: ""
# Used if repo is set to look up the version of the chart
version: ""
# Force recreate resource that can not be updated
force: false
# How long for helm to wait for the release to be active. If the value
# is less that or equal to zero, we will not wait in Helm
timeoutSeconds: 0
# Custom values that will be passed as values.yaml to the installation
values:
replicas: 2

View File

@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
selector:
matchLabels:
app: guestbook
tier: frontend
replicas: {{ .Values.replicas }}
template:
metadata:
labels:
app: guestbook
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google-samples/gb-frontend:v4
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 80

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
type: "{{ .Values.serviceType }}"
ports:
- port: 80
selector:
app: guestbook
tier: frontend

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-master
spec:
selector:
matchLabels:
app: redis
role: master
tier: backend
replicas: 1
template:
metadata:
labels:
app: redis
role: master
tier: backend
spec:
containers:
- name: master
image: redis
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: redis-master
labels:
app: redis
role: master
tier: backend
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: redis
role: master
tier: backend

View File

@@ -0,0 +1,29 @@
{{ if .Values.replication }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-slave
spec:
selector:
matchLabels:
app: redis
role: slave
tier: backend
replicas: 2
template:
metadata:
labels:
app: redis
role: slave
tier: backend
spec:
containers:
- name: slave
image: gcr.io/google_samples/gb-redisslave:v1
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379
{{ end }}

View File

@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: redis-slave
labels:
app: redis
role: slave
tier: backend
spec:
ports:
- port: 6379
selector:
app: redis
{{ if .Values.replication }}
role: slave
{{ else }}
role: master
{{ end }}
tier: backend

View File

@@ -0,0 +1,3 @@
replication: true
replicas: 1
serviceType: NodePort

View File

@@ -0,0 +1,16 @@
# Helm Example
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application
using kustomize. The app will be deployed into the `fleet-kustomize-example` namespace.
```yaml
kind: GitRepo
apiVersion: fleet.cattle.io/v1alpha1
metadata:
name: kustomize
namespace: fleet-local
spec:
repo: https://github.com/rancher/fleet-examples/
paths:
- single-cluster/kustomize
```

View File

@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
selector:
matchLabels:
app: guestbook
tier: frontend
replicas: 1
template:
metadata:
labels:
app: guestbook
tier: frontend
spec:
containers:
- name: php-redis
image: gcr.io/google-samples/gb-frontend:v4
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 80

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: frontend
labels:
app: guestbook
tier: frontend
spec:
type: NodePort
ports:
- port: 80
selector:
app: guestbook
tier: frontend

View File

@@ -0,0 +1,7 @@
resources:
- frontend-deployment.yaml
- frontend-service.yaml
- redis-master-deployment.yaml
- redis-master-service.yaml
- redis-slave-deployment.yaml
- redis-slave-service.yaml

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-master
spec:
selector:
matchLabels:
app: redis
role: master
tier: backend
replicas: 1
template:
metadata:
labels:
app: redis
role: master
tier: backend
spec:
containers:
- name: master
image: redis
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: redis-master
labels:
app: redis
role: master
tier: backend
spec:
ports:
- port: 6379
targetPort: 6379
selector:
app: redis
role: master
tier: backend

View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-slave
spec:
selector:
matchLabels:
app: redis
role: slave
tier: backend
replicas: 2
template:
metadata:
labels:
app: redis
role: slave
tier: backend
spec:
containers:
- name: slave
image: gcr.io/google_samples/gb-redisslave:v1
resources:
requests:
cpu: 100m
memory: 100Mi
ports:
- containerPort: 6379

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: redis-slave
labels:
app: redis
role: slave
tier: backend
spec:
ports:
- port: 6379
selector:
app: redis
role: slave
tier: backend

View File

@@ -0,0 +1,11 @@
# This file and all contents in it are OPTIONAL.
# The default namespace to apply to resources that are namespaced
# but do not specify a namespace. In this example no resources
# are configured with a namespace so this default will apply
namespace: fleet-kustomize-example
kustomize:
# To use a kustomization.yaml different from the one in the root folder
dir: ""

Some files were not shown because too many files have changed in this diff Show More