apiVersion: apps/v1
kind: Deployment
metadata:
name: spring-demo
spec:
selector:
matchLabels:
app: spring-demo
replicas: 3
template:
metadata:
labels:
app: spring-demo
spec:
containers:
- name: spring-demo
image: sooabia/spring-demo:1.0
ports:
- containerPort: 8080
---
kind: Service
apiVersion: v1
metadata:
name: spring-service
spec:
selector:
app: spring-demo
ports:
- protocol: TCP
port: 80
targetPort: 8080
type: LoadBalancer
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: redis
spec:
selector:
matchLabels:
app: redis
serviceName: redis
replicas: 1
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis
ports:
- containerPort: 6379
volumeMounts:
- name: data
mountPath: ./redisdata
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: 1Gi
---
kind: Service
apiVersion: v1
metadata:
name: redis
spec:
selector:
app: redis
ports:
- protocol: TCP
port: 6379
targetPort: 6379
type: ClusterIP |