• k8s 使用非root用户启动


    k8s 使用非root用户启动

    Dockerfile

    FROM   192.168.15.198/source/tomcat8_jdk1.8:202107131202
    
    MAINTAINER fengjian <627459560@qq.com>
    
    RUN groupadd -g 2000 fengjian && useradd -u 1000 -g 2000  fengjian
    
    RUN mkdir /data/webserver -p
    
    ADD start.sh /data/webserver/
    
    ADD gateway-0.0.1-SNAPSHOT.jar /data/webserver/
    
    RUN chown -R fengjian.fengjian /data/webserver  /data/logs  /data/tomcat  && 
        chmod +x /data/webserver/start.sh
    
    USER 1000:2000
    
    EXPOSE 8080
    
    ENTRYPOINT ["/data/webserver/start.sh"]

    k8s fengjian-deployment.yaml

    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: fengjian
      namespace: testfeng
    spec:
      selector:
        matchLabels:
          app: fengjian-label
      replicas: 1
      template:
        metadata:
          labels:
            app: fengjian-label
          annotations:
            "cni.projectcalico.org/ipv4pools": "["default-ipv4-ippool"]"
        spec:
          dnsConfig:
            options:
            - name: single-request-reopen
          containers:
          - name: fengjian
            image: 192.168.15.198/source/testfeng:202111010909
            imagePullPolicy: Always
            resources:
              limits:
                cpu: 1000m
                memory: 8192Mi
              requests:
                cpu: 100m
                memory: 1024Mi
            ports:
            - containerPort: 8080
            securityContext:
              runAsUser: 1000
              runAsGroup: 2000
  • 相关阅读:
    Floyd_Warshall算法
    Bellman_Ford算法
    深度优先搜索
    广度优先搜索
    贪心算法_活动选择
    动态规划_0-1背包问题
    算法导论_动态规划_最长回文子序列
    算法导论_动态规划_最长公共子序列
    动态规划解决分割问题
    2016 Google中国开发者大会游记
  • 原文地址:https://www.cnblogs.com/fengjian2016/p/15492517.html
Copyright © 2020-2023  润新知