-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Kubernetes Deployment manifest files
- Loading branch information
Showing
3 changed files
with
108 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,42 @@ | ||
# Installation | ||
|
||
A basic installation can be invoked with `kubectl apply -f ./kubernetes.yaml` | ||
|
||
```yaml | ||
$ kubectl apply -f ./kubernetes.yaml | ||
deployment.apps/rustpad-deployment created | ||
service/rustpad-service created | ||
``` | ||
|
||
We can the verify it is running | ||
``` | ||
$ kubectl get svc rustpad-service | ||
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE | ||
rustpad-service ClusterIP 10.43.83.244 <none> 80/TCP 17s | ||
$ kubectl get pods -l app=rustpad | ||
NAME READY STATUS RESTARTS AGE | ||
rustpad-deployment-8799874d6-g2jxb 1/1 Running 0 26s | ||
``` | ||
|
||
Then use port-forward to access | ||
``` | ||
$ kubectl port-forward svc/rustpad-service 8888:80 | ||
Forwarding from 127.0.0.1:8888 -> 3030 | ||
Forwarding from [::1]:8888 -> 3030 | ||
Handling connection for 8888 | ||
``` | ||
|
||
## Ingress | ||
|
||
Ingress depends much on your cluster-issuer and DNS names | ||
|
||
In the example `ingress.yaml` my ClusterIssuer is 'myclusterissuer', my ingress provider is 'nginx' and my DNS name is 'rustpad.example.com' | ||
|
||
Replace with your own to create a proper TLS ingress for Rustpad, then apply | ||
|
||
``` | ||
$ kubectl apply -f ./ingress.yaml | ||
ingress.networking.k8s.io/rustpadgcpingress created | ||
``` | ||
|
||
Note: if you use a different Ingress provider than Nginx, ensure it can support websocket forwarding if you want it to "connect" to the backend server. |
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,34 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
annotations: | ||
cert-manager.io/cluster-issuer: myclusterissuer | ||
ingress.kubernetes.io/proxy-body-size: "0" | ||
ingress.kubernetes.io/ssl-redirect: "true" | ||
kubernetes.io/ingress.class: nginx | ||
kubernetes.io/tls-acme: "true" | ||
nginx.ingress.kubernetes.io/proxy-body-size: "0" | ||
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" | ||
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" | ||
nginx.ingress.kubernetes.io/ssl-redirect: "true" | ||
nginx.org/client-max-body-size: "0" | ||
nginx.org/proxy-connect-timeout: "3600" | ||
nginx.org/proxy-read-timeout: "3600" | ||
nginx.org/websocket-services: rustpad-service | ||
name: rustpadgcpingress | ||
spec: | ||
rules: | ||
- host: rustpad.example.com | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: rustpad-service | ||
port: | ||
number: 80 | ||
path: / | ||
pathType: ImplementationSpecific | ||
tls: | ||
- hosts: | ||
- rustpad.example.com | ||
secretName: rustpadgcp-tls |
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,32 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: rustpad-deployment | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: rustpad | ||
template: | ||
metadata: | ||
labels: | ||
app: rustpad | ||
spec: | ||
containers: | ||
- name: rustpad-container | ||
image: ekzhang/rustpad | ||
ports: | ||
- containerPort: 3030 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: rustpad-service | ||
spec: | ||
selector: | ||
app: rustpad | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 3030 | ||
|