-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from slickwarren/cwarren/hardened-example
adding example for hardened linux clusters based on 'simple' example
- Loading branch information
Showing
8 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Hardened Example | ||
|
||
This example will deploy the [Kubernetes sample guestbook](https://github.com/kubernetes/examples/tree/master/guestbook/) application, with modifications to securityContext which allow its deployment on a hardened cluster. | ||
The app will be deployed into the `default` namespace. Note that you must have added the `default` namespace to the PSA to allow deployments to this namespace. | ||
|
||
```yaml | ||
kind: GitRepo | ||
apiVersion: fleet.cattle.io/v1alpha1 | ||
metadata: | ||
name: simple | ||
namespace: fleet-local | ||
spec: | ||
repo: https://github.com/rancher/fleet-examples | ||
paths: | ||
- hardened | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
namespace: hardened-fleet-deployments | ||
|
||
namespaceLabels: | ||
pod-security.kubernetes.io/enforce: baseline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: frontend | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: guestbook | ||
tier: frontend | ||
replicas: 3 | ||
template: | ||
metadata: | ||
labels: | ||
app: guestbook | ||
tier: frontend | ||
spec: | ||
containers: | ||
- name: php-redis | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
runAsNonRoot: true | ||
runAsUser: 1000 | ||
seccompProfile: | ||
type: RuntimeDefault | ||
capabilities: | ||
drop: ["ALL"] | ||
image: us-docker.pkg.dev/google-samples/containers/gke/gb-frontend:v5 | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 100Mi | ||
ports: | ||
- containerPort: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
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:7-alpine | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
runAsNonRoot: true | ||
runAsUser: 1000 | ||
seccompProfile: | ||
type: RuntimeDefault | ||
capabilities: | ||
drop: ["ALL"] | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 100Mi | ||
ports: | ||
- containerPort: 6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
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: redis:7-alpine | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
runAsNonRoot: true | ||
runAsUser: 1000 | ||
seccompProfile: | ||
type: RuntimeDefault | ||
capabilities: | ||
drop: ["ALL"] | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 100Mi | ||
ports: | ||
- containerPort: 6379 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |