• init container


    init container与应用容器在本质上是一样的, 但它们是仅运行一次就结束的任务, 并且必须在成功执行完成后, 系统才能继续执行下一个容器, 可以用在例如应用容器启动前做一些初始化工作,当init container执行失败, 而且设置了RestartPolicy=Never时, Pod将会启动失败, 而设置了RestartPolicy=Always时, pod将会被系统自动重启

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: nginx-deployment
      namespace: default 
      labels:
        app: nginx
    spec:
      selector:
        matchLabels:
          app: nginx
      replicas: 1
      template:
        metadata:
          labels:
            app: nginx
        spec:
          initContainers: 
          - name: install
            image: busybox
            imagePullPolicy: IfNotPresent
            command:
            - wget
            - "-O"
            - "/work-dir/index.html"
            - http://kubernetes.io
            volumeMounts:
            - name: workdir
              mountPath: "/work-dir"
          containers:
          - name: nginx
            image: nginx:1.12
            imagePullPolicy: IfNotPresent
            ports:
            - containerPort: 80
            volumeMounts:
            - name: workdir
              mountPath: "/usr/share/nginx/html"
          volumes:
          - name: workdir
            emptyDir: {} 
    
    ---
    apiVersion: v1 
    kind: Service
    metadata:
      name: nginx-service
      namespace: default 
      labels:
        app: nginx
    spec:
      type: NodePort
      selector: 
        app: nginx
      ports:
      - name: http
        port: 80 
        protocol: TCP 
        targetPort: 80 
    ---
    
  • 相关阅读:
    tctip demo页面>
    tctip demo页面>
    tctip demo页面>
    tctip demo页面>
    tctip demo页面>
    tctip demo页面>
    关于值类型与列类型不匹配,所需类型是 DataRow"的解决方案
    如何给excel设置密码
    Excel如何将大写字符转化为小写
    C#调用WebService(服务引用-xml)
  • 原文地址:https://www.cnblogs.com/lovelinux199075/p/11243817.html
Copyright © 2020-2023  润新知