<p>I've been trying to get a kuberentes pod to access an external oracle databased. When the pod spins up, the PID associated to accessing the external oracle database hangs and does not timeout. </p>

<p>Here is my yaml:</p>

<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: neuron-oracle-producer-clinrpt
  namespace: pubsub
spec:
  template:
    metadata:
      labels:
        app: neuron-oracle-producer-clinrpt
    spec:
      restartPolicy: Never
      hostNetwork: true
      containers:
      - name: neuron-oracle-producer-clinrpt
        image: ndtregistry.azurecr.io/neuron-oracle-producer-clinrpt:latest
        imagePullPolicy: Always
        command: ["neuron-oracle-producer-clinrpt"]
        ports:
          - containerPort: 1521
            hostPort: 1521
        env:
        - name: ORA_USERNAME
          valueFrom:
            secretKeyRef:
              name: clinrpt
              key: username
        - name: ORA_PASSWORD
          valueFrom:
            secretKeyRef:
              name: clinrpt
              key: password
        - name: QUEUE_HOST
          value: "broker.kafka.svc.cluster.local"
        - name: QUEUE_PORT
          value: "9092"
        - name: QUEUE_CATEGORIES
          value: "json"
        - name: LOG_FILE
          value: "/var/log/neuron-oracle-producer-clinrpt.txt"
        - name: MESSAGE_SOURCE
          value: "ClinRpt"
        - name: MESSAGE_FORMAT
          value: "json"
        - name: DEBUG
          value: "TRUE"
        resources:
          requests:
            cpu: 500m
            memory: 1Gi
          limits:
            cpu: 500m
            memory: 1Gi
        volumeMounts:
        - name: logs
          mountPath: /var/log/producer
      imagePullSecrets:
      - name: azureregistry
      volumes:
      - name: logs
        emptyDir: {}
</code></pre>

<p>How do I get my pod to access an external oracle database? </p>

Bryan Nice
<p>This is probably too late, but you may want to try to add: </p>

<ol>
<li>a k8s service to let the pod know there is a DB to call</li>
<li>a k8s endpoint to map the external IP address to the service</li>
</ol>

<p>Rationale: by default K8s searches for local services. This creates a local service with a mapping to an external service's URI. More info: <a href="https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-mapping-external-services" rel="nofollow noreferrer">https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-mapping-external-services</a></p>
