我一直在尝试让 kuberentes pod 访问数据库中的外部 oracle。当 pod 启动时,与访问外部 oracle 数据库相关的 PID 会挂起并且不会超时。
这是我的yaml:
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: {}
如何让我的 pod 访问外部 oracle 数据库?