Last active
February 25, 2022 15:36
-
-
Save dennbagas/44e942905bca9cf3305c5307b31e7c33 to your computer and use it in GitHub Desktop.
Golang in container Hot Reload
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
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: my-app-pv-volume | |
namespace: my-namespace | |
spec: | |
storageClassName: manual | |
capacity: | |
storage: 1Gi | |
accessModes: | |
- ReadWriteOnce | |
hostPath: | |
path: "/tmp/golang" | |
--- | |
apiVersion: v1 | |
kind: PersistentVolumeClaim | |
metadata: | |
namespace: my-namespace | |
name: my-app-pv-claim | |
spec: | |
storageClassName: manual | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 1Gi | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: my-app | |
namespace: my-namespace | |
spec: | |
selector: | |
matchLabels: | |
app: my-app | |
strategy: | |
type: Recreate | |
template: | |
metadata: | |
labels: | |
app: my-app | |
spec: | |
volumes: | |
- name: my-app-pv-storage | |
persistentVolumeClaim: | |
claimName: my-app-pv-claim | |
containers: | |
- name: my-app | |
image: my-app:latest | |
volumeMounts: | |
- mountPath: "/go/src/app" # the mountPath sould same as Dockerfile WORKDIR | |
name: my-app-pv-storage | |
serviceAccountName: my-app-sa # assign the ServiceAccount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment