k8s之配置springboot项目
配置k8s,java17镜像,mysql5.6镜像。
一,准备环境:
配置k8s,java17镜像,mysql5.6镜像
二,部署
1),jvb-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: jvb-pv
namespace: jvb
labels:
app: jvb-pv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Recycle
nfs:
path: /kube/jvb
server: 192.168.142.137
2), jvb-pvc.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: jvb-pvc
namespace: jvb
labels:
app: jvb-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
selector:
matchLabels:
app: jvb-pv
3), jvb-deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: jvb-deploy
namespace: jvb
labels:
app: jvb-deploy
spec:
selector:
matchLabels:
app: jvb-pod
strategy:
type: Recreate
template:
metadata:
labels:
app: jvb-pod
spec:
containers:
- image: java:17
name: jvb-pod
command: ["sleep"]
args: ["infinity"]
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9999
volumeMounts:
- name: jvb-dir
mountPath: /myblog
volumes:
- name: jvb-dir
persistentVolumeClaim:
claimName: jvb-pvc
更多推荐
所有评论(0)