Skip to content

Commit

Permalink
add storage, delete script, docs for port forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
IkeHunter committed Nov 17, 2024
1 parent 48f4125 commit 8020652
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 6 deletions.
26 changes: 26 additions & 0 deletions k8s/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,29 @@
```sh
minikube dashboard
```

### Accessing Cluster

The general way to access a nodeport is via the following command:

```sh
kubectl port-forward svc/service-name host-port:service-port --namespace namespace
```

Running this command will start a long-running process in that terminal tab. You would start a new terminal instance for each port you forward.

#### Forwarding Base Routes

Run this command to open up the base 8080 port onto 30080 on your local machine:

```sh
kubectl port-forward svc/proxy 30080:8080 --namespace main
```

#### Forwarding Club Manager Admin

Use this command to forward the port 8081, used for the club manager site/admin, onto 30081 of your local machine:

```sh
kubectl port-forward svc/proxy 30081:8081 --namespace main
```
6 changes: 0 additions & 6 deletions k8s/namespaces.yml

This file was deleted.

4 changes: 4 additions & 0 deletions k8s/scripts/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ helm install redis ./charts/redis \
--namespace redis \
--create-namespace

# Create main namespace if it doesn't exist
kubectl create namespace main --dry-run=client -o yaml | kubectl apply -f -

# Apply kubernetes files
kubectl apply -f namespaces.yml
kubectl apply -f .

8 changes: 8 additions & 0 deletions k8s/scripts/destroy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

set -e

kubectl delete -f . --grace-period=0 --force --wait=false

helm uninstall postgres --namespace postgres
helm uninstall redis --namespace redis
41 changes: 41 additions & 0 deletions k8s/storage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
########################
## Volume Definitions ##
########################
# What volumes exist and how

---
apiVersion: v1
kind: PersistentVolume
metadata:
name: cluster-storage
namespace: main
spec:
storageClassName: cluster-pv
capacity:
storage: 20Gi
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
persistentVolumeReclaimPolicy: Recycle
hostPath:
path: /mnt/data
type: DirectoryOrCreate

###################
## Volume Claims ##
###################
# Who is assigned what volume

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: club-static-pvc
namespace: main
spec:
storageClassName: cluster-pv
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1G
13 changes: 13 additions & 0 deletions k8s/workloads.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#############################
## Jukebox Server Workload ##
#############################
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -20,6 +23,9 @@ spec:
- configMapRef:
name: jukebox-server-config

############################
## Reverse Proxy Workload ##
############################
---
apiVersion: apps/v1
kind: Deployment
Expand All @@ -42,6 +48,9 @@ spec:
- configMapRef:
name: proxy-config

##################################
## Club Manager Server Workload ##
##################################
---
apiVersion: apps/v1
kind: Deployment
Expand All @@ -63,3 +72,7 @@ spec:
envFrom:
- configMapRef:
name: club-manager-config
volumes:
- name: club-static
persistentVolumeClaim:
claimName: club-static-pvc

0 comments on commit 8020652

Please sign in to comment.