refactor: Update API deployment and service names to match component name change
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: api-cluster-ip-service
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
component: api
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
@@ -0,0 +1,28 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: api-deployment
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
component: api
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: api
|
||||
spec:
|
||||
containers:
|
||||
- name: api
|
||||
image: uxioandrade/tutorial-api
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
env:
|
||||
- name: PG_HOST
|
||||
value: postgres-cluster-ip-service
|
||||
- name: PG_PORT
|
||||
value: '5432'
|
||||
- name: PGUSER
|
||||
value: postgres
|
||||
- name: PGDATABASE
|
||||
value: postgres
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: client-cluster-ip-service
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
component: client
|
||||
ports:
|
||||
- port: 3000
|
||||
targetPort: 3000
|
||||
@@ -0,0 +1,20 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: client-deployment
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
component: client
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
component: client
|
||||
spec:
|
||||
containers:
|
||||
- name: client
|
||||
image: uxioandrade/tutorial-client
|
||||
ports:
|
||||
- containerPort: 3000
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: database-persistent-volume-claim
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
@@ -0,0 +1,25 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: ingress-service
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: nginx
|
||||
nginx.ingress.kubernetes.io/rewrite-target: /$1
|
||||
spec:
|
||||
rules:
|
||||
- http:
|
||||
paths:
|
||||
- path: /?(.*)
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: client-cluster-ip-service
|
||||
port:
|
||||
number: 3000
|
||||
- path: /api/?(.*)
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: api-cluster-ip-service
|
||||
port:
|
||||
number: 8080
|
||||
@@ -0,0 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: postgres-cluster-ip-service
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
component: postgres
|
||||
ports:
|
||||
- port: 5432
|
||||
targetPort: 5432
|
||||
@@ -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
|
||||
@@ -0,0 +1,31 @@
|
||||
# nginx_ingress_test stack
|
||||
|
||||
```bash
|
||||
minikube start
|
||||
k create ns nginx_ingress_test
|
||||
kubectl config set-context --current --namespace=nginx_ingress_test
|
||||
|
||||
# kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
|
||||
helm upgrade --install ingress-nginx ingress-nginx \
|
||||
--repo https://kubernetes.github.io/ingress-nginx \
|
||||
--namespace ingress-nginx --create-namespace
|
||||
minikube addons enable ingress
|
||||
|
||||
k apply -f nginx_ingress_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