Add TLS Certificate in openshift container’s trusted CA root certificate store

I have a springboot application that connects to a mail server using TLS certificate.
I am trying to follow the third method in this article, but it is not working.

I made changes to load the certificate from the secret in the template file. We use Jenkins pipeline to run the deployment, and I am not seeing any errors when I run the deployment, but when the app tries to connect to the mail server, I am still getting the certificate error:

"javax.mail.MessagingException: Could not convert socket to TLS;
nested exception is:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target"

I am not sure if I put the volumeMount correctly, or if I am missing something.
Any help will be greatly appreciated.

What I did so far is the following:

  1. I imported the ca certificate (PEM) file into a generic secret on openshift, the secret called ca-cert-secret, and has a key with same name
  2. I tried to change the kubernetes template for the DeployConfig to import the certificate from the secret as follow:
apiVersion: v1
kind: Template
metadata:
  name: my-app-runtime
labels:
  template: my-app-runtime
  app: my-app 
parameters:
- name: ENV_NAME
  description: environment level being created such as master,sys, qa, prd
- name: NAMESPACE
  description: namespace to use in generating artifacts
  
objects:
- apiVersion: v1
  kind: DeploymentConfig
  metadata:
    generation: 1
    labels:
      app: ${NAMESPACE}-${ENV_NAME}
      environment: ${ENV_NAME}
    name: ${NAMESPACE}-${ENV_NAME}
  spec:
    replicas: ${{REPLICAS}}
    selector:
      deploymentconfig: ${NAMESPACE}-${ENV_NAME}
    strategy:
      activeDeadlineSeconds: 21600
      resources: {}
      rollingParams:
        intervalSeconds: 1
        maxSurge: 25%
        maxUnavailable: 25%
        timeoutSeconds: 600
        updatePeriodSeconds: 1
      type: Rolling
    template:
      metadata:
        creationTimestamp: null
        labels:
          deploymentconfig: ${NAMESPACE}-${ENV_NAME}
          environment:  ${ENV_NAME}
      spec:
        containers:
        - env:
          - name: GC_MAX_METASPACE_SIZE
            value: '300'
          - name: JAVA_OPTS_APPEND
            value: ${JAVA_OPTS_APPEND}                                          
          image: ${REGISTRY_HOST}/${PROJECT_NAME}/${NAMESPACE}:${IMAGE_TAG}
          imagePullPolicy: Always
          name: ${NAMESPACE}-${ENV_NAME}
          ports:
          - containerPort: 8080
            protocol: TCP
          resources:
            limits:
              memory: ${{MEMORY_LIMIT}}
            requests:
              cpu: ${{CPU_REQUEST}}
              memory: ${{MEMORY_REQUEST}}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
        dnsPolicy: ClusterFirst
        restartPolicy: Always
        schedulerName: default-scheduler
        securityContext: {}
        terminationGracePeriodSeconds: 30
        volumeMounts:
        - name: ca-cert-volume
          mountPath: /etc/pki/ca-trust/source/anchors/ca.crt
          subPath: ca.crt  
        volumes:
        - name: ca-cert-volume
          secret:
            secretName: ca-cert-secret          
    test: false
    triggers:
    - type: ConfigChange

- apiVersion: v1
  kind: Service
  metadata:
    labels:
      app: ${NAMESPACE}
      environment: ${ENV_NAME}
    name: ${NAMESPACE}-${ENV_NAME}
  spec:
    ports:
    - name: 8080-tcp
      port: 8080
      protocol: TCP
      targetPort: 8080
    selector:
      deploymentconfig: ${NAMESPACE}-${ENV_NAME}
    sessionAffinity: None
    type: ClusterIP
  status:
    loadBalancer: {}
- apiVersion: v1
  kind: Route
  metadata:
    labels:
      app: ${NAMESPACE}
      environment: ${ENV_NAME}
    name: ${NAMESPACE}-${ENV_NAME}
  spec:
    host: ${ROUTE_HOST}
    port:
      targetPort: 8080-tcp
    tls:
      termination: edge
    to:
      kind: Service
      name: ${NAMESPACE}-${ENV_NAME}
      weight: 100
    wildcardPolicy: None    

New contributor

Sandy AB is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật