美文网首页
K8s yaml demo

K8s yaml demo

作者: jojo1313 | 来源:发表于2023-04-24 15:47 被阅读0次
    说明:
    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

    相关文章

      网友评论

          本文标题:K8s yaml demo

          本文链接:https://www.haomeiwen.com/subject/ksbujdtx.html