<p>Running a k8 cronjob on an endpoint. Test works like a charm locally and even when I <code>sleep infinity</code> at the end of my entrypoint then curl inside the container. However once the cron kicks off I get some funky error:</p>
<pre><code>[ec2-user@ip-10-122-8-121 device-purge]$ kubectl logs appgate-device-cron-job-1618411080-29lgt -n device-purge
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to 52.61.245.214:444
</code></pre>
<p>docker-entrypoint.sh</p>
<pre><code>#! /bin/sh
export api_vs_hd=$API_VS_HD
export controller_ip=$CONTROLLER_IP
export password=$PASSWORD
export uuid=$UUID
export token=$TOKEN

# should be logged in after token export
# Test API call: list users
curl -k -H &quot;Content-Type: application/json&quot; \
     -H &quot;$api_vs_hd&quot; \
     -H &quot;Authorization: Bearer $token&quot; \
     -X GET \
     https://$controller_ip:444/admin/license/users

# test
# sleep infinity
</code></pre>
<p>Dockerfile</p>
<pre><code>FROM harbor/privateop9/python38:latest

# Use root user for packages installation
USER root

# Install packages
RUN yum update -y &amp;&amp; yum upgrade -y

# Install curl
RUN yum install curl -y \
    &amp;&amp; curl --version

# Install zip/unzip/gunzip
RUN yum install zip unzip -y \
    &amp;&amp; yum install gzip -y

# Install wget 
RUN yum install wget -y

# Install jq
RUN wget -O jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
RUN chmod +x ./jq
RUN cp jq /usr/bin

# Install aws cli
RUN curl &quot;https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip&quot; -o &quot;awscliv2.zip&quot;
RUN unzip awscliv2.zip
RUN ./aws/install

## set working directory
WORKDIR /home/app

# Add user
RUN groupadd --system user &amp;&amp; adduser --system user --no-create-home --gid user
RUN chown -R user:user /home/app &amp;&amp; chmod -R 777 /home/app

# Make sure that your shell script file is in the same folder as your dockerfile while running the docker build command as the below command will copy the file to the /home/root/ folder for execution
# COPY . /home/root/
COPY ./docker-entrypoint.sh /home/app
RUN chmod +x docker-entrypoint.sh

# Switch to non-root user
USER user

# Run service
ENTRYPOINT [&quot;/home/app/docker-entrypoint.sh&quot;]
</code></pre>
<p>Cronjob.yaml</p>
<pre><code>apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: device-cron-job
  namespace: device-purge
spec:
#Cron Time is set according to server time, ensure server time zone and set accordingly.
  schedule: &quot;*/2 * * * *&quot; # test
  jobTemplate:
    spec:
      template:
        spec:
          imagePullSecrets:
          - name: appgate-cron
          containers:
          - name: device-cron-pod
            image: harbor/privateop9/python38:device-purge
            env:
            - name: API_VS_HD
              value: &quot;Accept:application/vnd.appgate.peer-v13+json&quot;
            - name: CONTROLLER_IP
              value: &quot;value&quot;
            - name: UUID
              value: &quot;value&quot;
            - name: TOKEN
              value: &gt;-
                curl -H &quot;Content-Type: application/json&quot; -H &quot;${api_vs_hd}&quot; --request POST
                --data &quot;{\&quot;providerName\&quot;:\&quot;local\&quot;,\&quot;username\&quot;:\&quot;admin\&quot;,\&quot;password\&quot;:\&quot;$password\&quot;,\&quot;deviceId\&quot;:\&quot;$uuid\&quot;}&quot;
                https://$controller_ip:444/admin/login --insecure | jq -r '.token'
            - name: PASSWORD
              valueFrom:
                secretKeyRef: 
                  name: password
                  key: password

            imagePullPolicy: Always
          restartPolicy: OnFailure
      backoffLimit: 3
</code></pre>
<p>Please help! I am running out of ideas....</p>

<p>The issue with my post was on the server itself due to some firewall with the IP whitelisting set up on the AWS cloud account. After that problem was addressed by the security team on the account I was able to pass the blocker.</p>
