-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy webapp on local kubernetes clusters
- Loading branch information
Showing
5 changed files
with
69 additions
and
1 deletion.
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,27 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: webapp-photo2monet | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: webapp-photo2monet | ||
template: | ||
metadata: | ||
labels: | ||
app: webapp-photo2monet | ||
spec: | ||
containers: | ||
- name: webapp | ||
# image: zcycyrus/photo2monet-dockerhub:webapp_latest | ||
image: zcycyrus/photo2monet-dockerhub:local-test | ||
ports: | ||
- containerPort: 5000 | ||
volumeMounts: | ||
- name: model-volume | ||
mountPath: /app/models # Directory in the container | ||
volumes: | ||
- name: model-volume | ||
persistentVolumeClaim: | ||
claimName: model-pvc |
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: PersistentVolume | ||
metadata: | ||
name: model-pv | ||
spec: | ||
storageClassName: manual | ||
capacity: | ||
storage: 2Gi | ||
accessModes: | ||
- ReadWriteOnce | ||
hostPath: | ||
path: "C:/Monet_Local/webapp" | ||
# Ensure this is the correct path where your model file is stored on your machine | ||
# translated from windows style C:\Monet_Local\webapp to linux |
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,11 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: model-pvc | ||
spec: | ||
storageClassName: manual | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 2Gi |
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 @@ | ||
#!/bin/bash | ||
|
||
# Print a message | ||
echo "Deploying the web application..." | ||
|
||
# Apply the deployment configuration from the deployment.yaml file | ||
kubectl apply -f ./k8s/deployment.yaml | ||
|
||
# Restart the deployment to use the latest Docker image, if updated | ||
echo "Restarting the deployment to ensure the latest image is used..." | ||
kubectl rollout restart deployment/webapp-photo2monet | ||
|
||
# Provide feedback that the deployment has been triggered | ||
echo "Deployment has been updated. Check the status with 'kubectl get pods' to ensure pods are running." |
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