-
Notifications
You must be signed in to change notification settings - Fork 0
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
zero: add kustomize #4
base: main
Are you sure you want to change the base?
Changes from all commits
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 @@ | ||
pomerium-secret.yaml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Installing Pomerium Zero | ||
|
||
Visit https://console.pomerium.app and register for an account. | ||
|
||
# Install base pomerium zero | ||
|
||
```shell | ||
kubectl apply -k https://github.com/pomerium/pomerium/k8s/zero?ref=main | ||
``` | ||
|
||
(that would install an evergreen `main`) | ||
|
||
# Create a secret with Pomerium Zero token to complete your installation | ||
|
||
```yaml filename="pomerium-secret.yaml" | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: pomerium | ||
namespace: pomerium-zero | ||
type: Opaque | ||
stringData: | ||
pomerium_zero_token: | ||
``` | ||
|
||
```shell | ||
kubectl apply -f pomerium-secret.yaml | ||
``` | ||
|
||
Now your Pomerium deployment should be up and running. | ||
|
||
# Update Pomerium cluster configuration | ||
|
||
1. The externally available address of your Pomerium Cluster should be set to the value assigned by your Load Balancer: | ||
|
||
```shell | ||
kubectl get svc/pomerium-proxy -n pomerium-zero -o=jsonpath='{.status.loadBalancer.ingress[0].ip}' | ||
``` | ||
|
||
2. Because container is configured to run as non-root, the following should be adjusted: | ||
|
||
- http redirect address set to `:8080` | ||
- server address set to `:8443` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: pomerium | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: pomerium-zero | ||
template: | ||
spec: | ||
automountServiceAccountToken: true | ||
serviceAccountName: pomerium-zero | ||
containers: | ||
- name: pomerium | ||
terminationGracePeriodSeconds: 10 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: pomerium | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: pomerium | ||
env: | ||
- name: POMERIUM_ZERO_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: pomerium | ||
key: pomerium_zero_token | ||
optional: false | ||
- name: POMERIUM_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: metadata.namespace | ||
- name: BOOTSTRAP_CONFIG_FILE | ||
value: "/var/run/secrets/pomerium/bootstrap.dat" | ||
- name: BOOTSTRAP_CONFIG_WRITEBACK_URI | ||
value: "secret://$(POMERIUM_NAMESPACE)/pomerium/bootstrap" | ||
- name: POD_IP | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.podIP |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: pomerium | ||
spec: | ||
replicas: 1 | ||
template: | ||
spec: | ||
containers: | ||
- name: pomerium | ||
image: pomerium/pomerium:v0.27.2 | ||
imagePullPolicy: IfNotPresent |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
resources: | ||
- base.yaml | ||
patchesStrategicMerge: | ||
- env.yaml | ||
- image.yaml | ||
- ports.yaml | ||
- resources.yaml | ||
- no-root.yaml | ||
- readonly-root-fs.yaml | ||
- volumes.yaml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: pomerium | ||
spec: | ||
template: | ||
spec: | ||
securityContext: | ||
fsGroup: 1000 | ||
runAsNonRoot: true | ||
runAsGroup: 1000 | ||
runAsUser: 1000 | ||
sysctls: | ||
- name: net.ipv4.ip_unprivileged_port_start | ||
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. Would it make sense to include port 443 here as well? Consider adding a comment explaining why certain ports are prioritized. |
||
value: "80" | ||
containers: | ||
- name: pomerium | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
capabilities: | ||
drop: | ||
- ALL |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: pomerium | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: pomerium | ||
ports: | ||
- containerPort: 443 | ||
name: https | ||
protocol: TCP | ||
- name: http | ||
containerPort: 80 | ||
protocol: TCP | ||
- name: metrics | ||
containerPort: 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. consider explaining what each port is for (especially 80 and 9090 being for redirect and metrics) |
||
protocol: TCP |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: pomerium | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: pomerium | ||
securityContext: | ||
readOnlyRootFilesystem: true | ||
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. Consider adding a comment explaining why this is important for security |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: pomerium | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: pomerium | ||
resources: | ||
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. Could you provide additional context on these resources? A comment explaining their purpose and how they’re used here and why they are the defaults would be helpful. |
||
limits: | ||
cpu: 5000m | ||
memory: 1Gi | ||
requests: | ||
cpu: 300m | ||
memory: 200Mi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: pomerium | ||
spec: | ||
template: | ||
spec: | ||
nodeSelector: | ||
kubernetes.io/os: linux | ||
containers: | ||
- name: pomerium | ||
env: | ||
- name: TMPDIR | ||
value: "/tmp/pomerium" | ||
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. Could you add a comment explaining the purpose of each 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. various parts of stdlib and other libraries we use make use of TMPDIR and XDG_CACHE |
||
- name: XDG_CACHE_HOME | ||
value: "/tmp/pomerium/cache" | ||
- name: XDG_DATA_HOME | ||
value: "/tmp/pomerium/cache" | ||
volumeMounts: | ||
- mountPath: "/tmp/pomerium" | ||
name: tmp | ||
- mountPath: "/var/run/secrets/pomerium" | ||
name: bootstrap | ||
readOnly: true | ||
volumes: | ||
- name: tmp | ||
emptyDir: | ||
sizeLimit: 500Mi | ||
- name: bootstrap | ||
secret: | ||
optional: true | ||
secretName: pomerium | ||
items: | ||
- key: bootstrap | ||
path: bootstrap.dat |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace: pomerium-zero | ||
commonLabels: | ||
app.kubernetes.io/name: pomerium-zero | ||
resources: | ||
- namespace.yaml | ||
- ./rbac | ||
- ./deployment | ||
- ./service |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: pomerium-zero |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: pomerium | ||
namespace: pomerium-zero | ||
type: Opaque | ||
stringData: | ||
pomerium_zero_token: YOUR_TOKEN_HERE |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- role.yaml | ||
- role_binding.yaml | ||
- service_account.yaml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: pomerium-zero | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- secrets | ||
verbs: | ||
- patch | ||
resourceNames: | ||
- pomerium |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: pomerium-zero | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: pomerium-zero | ||
subjects: | ||
- kind: ServiceAccount | ||
name: pomerium-zero |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: pomerium-zero |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
resources: | ||
- proxy.yaml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: pomerium-proxy | ||
spec: | ||
type: LoadBalancer | ||
externalTrafficPolicy: Local | ||
ports: | ||
- port: 443 | ||
targetPort: https | ||
protocol: TCP | ||
name: https | ||
- name: http | ||
targetPort: http | ||
protocol: TCP | ||
port: 80 |
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 this maps to true readyness /live however....