K8s yaml demo

2023-04-24  本文已影响0人  jojo1313
说明:
1.使用了longhor作为pvc存储卷挂载到容器中,claimName是pvc name
2.使用了hatbor存储私有镜像后从harbor拉取镜像,imagePullSecrets指定拉取密钥
注意事项:(图1)longhor不支持多个pod重复挂载,所以如果使用longhor可能不支持多副本同时runing

apiVersion: apps/v1
kind: Deployment
metadata:
  name: showdoc
  namespace: default
  labels:
    app: showdoc
spec:
  replicas: 1
  selector:
    matchLabels:
      app: showdoc
  template:
    metadata:
      labels:
        app: showdoc
    spec:
      containers:
        - name: showdoc
          image: registry.icloud.net/showdoc/showdoc:v1
          imagePullPolicy: Always
          ports:
            - containerPort: 80
              hostPort: 10017
          volumeMounts:
            - name: config
              mountPath: /var/www/html
      volumes:
        - name: config
          persistentVolumeClaim:
            claimName: showdoc-volume1
      imagePullSecrets:
        - name: regcred

图1:


image.png
上一篇下一篇

猜你喜欢

热点阅读