mirror of
https://github.com/furyhawk/cloudy.git
synced 2026-05-23 00:16:49 +00:00
refactor: Update API deployment and service names to match component name change
This commit is contained in:
@@ -1,27 +1,28 @@
|
|||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: postgres-deployment
|
name: api-deployment
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
component: postgres
|
component: api
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
component: postgres
|
component: api
|
||||||
spec:
|
spec:
|
||||||
volumes:
|
|
||||||
- name: postgres-storage
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: database-persistent-volume-claim
|
|
||||||
containers:
|
containers:
|
||||||
- name: postgres
|
- name: api
|
||||||
image: postgres
|
image: uxioandrade/tutorial-api
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 5432
|
- containerPort: 8080
|
||||||
volumeMounts:
|
env:
|
||||||
- name: postgres-storage
|
- name: PG_HOST
|
||||||
mountPath: /var/lib/postgresql/data
|
value: postgres-cluster-ip-service
|
||||||
subPath: postgres
|
- name: PG_PORT
|
||||||
|
value: '5432'
|
||||||
|
- name: PGUSER
|
||||||
|
value: postgres
|
||||||
|
- name: PGDATABASE
|
||||||
|
value: postgres
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
apiVersion: extensions/v1beta1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: ingress-service
|
name: ingress-service
|
||||||
@@ -10,10 +10,16 @@ spec:
|
|||||||
- http:
|
- http:
|
||||||
paths:
|
paths:
|
||||||
- path: /?(.*)
|
- path: /?(.*)
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
serviceName: client-cluster-ip-service
|
service:
|
||||||
servicePort: 3000
|
name: client-cluster-ip-service
|
||||||
|
port:
|
||||||
|
number: 3000
|
||||||
- path: /api/?(.*)
|
- path: /api/?(.*)
|
||||||
|
pathType: Prefix
|
||||||
backend:
|
backend:
|
||||||
serviceName: api-cluster-ip-service
|
service:
|
||||||
servicePort: 8080
|
name: api-cluster-ip-service
|
||||||
|
port:
|
||||||
|
number: 8080
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: postgres-deployment
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
component: postgres
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
component: postgres
|
||||||
|
spec:
|
||||||
|
volumes:
|
||||||
|
- name: postgres-storage
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: database-persistent-volume-claim
|
||||||
|
containers:
|
||||||
|
- name: postgres
|
||||||
|
image: postgres
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
value: whatever
|
||||||
|
ports:
|
||||||
|
- containerPort: 5432
|
||||||
|
volumeMounts:
|
||||||
|
- name: postgres-storage
|
||||||
|
mountPath: /var/lib/postgresql/data
|
||||||
|
subPath: postgres
|
||||||
+25
-6
@@ -1,12 +1,31 @@
|
|||||||
# test stack
|
# test stack
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
minikube start
|
||||||
k create ns test
|
k create ns test
|
||||||
kubectl config set-context --current --namespace=test
|
kubectl config set-context --current --namespace=test
|
||||||
k apply -f api-deployment.yaml -f client-deployment.yaml
|
|
||||||
k apply -f database-persistent-volume-claim.yaml
|
# kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
|
||||||
k apply -f api-cluster-ip-service.yaml
|
helm upgrade --install ingress-nginx ingress-nginx \
|
||||||
k apply -f client-cluster-ip-deployment.yaml
|
--repo https://kubernetes.github.io/ingress-nginx \
|
||||||
k apply -f postgres-cluster-ip-service.yaml
|
--namespace ingress-nginx --create-namespace
|
||||||
k apply -f ingress-service.yaml
|
minikube addons enable ingress
|
||||||
|
|
||||||
|
k apply -f test
|
||||||
|
minikube ip
|
||||||
|
|
||||||
|
minikube tunnel
|
||||||
|
|
||||||
|
# Wait for ingress address
|
||||||
|
|
||||||
|
# kubectl get ingress
|
||||||
|
# NAME CLASS HOSTS ADDRESS PORTS AGE
|
||||||
|
# example-ingress nginx * <your_ip_here> 80 5m45s
|
||||||
|
|
||||||
|
# Note for Docker Desktop Users:
|
||||||
|
# To get ingress to work you’ll need to open a new terminal window and run minikube tunnel and in the following step use 127.0.0.1 in place of <ip_from_above>.
|
||||||
|
|
||||||
|
minikube delete --all --purge
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user