cat <<EOF | oc apply -f -
---
apiVersion: v1
kind: Pod
metadata:
name: curl-pod
labels:
app: support
spec:
containers:
- name: curl-pod
image: 'registry.redhat.io/rhel8/support-tools'
command:
- "/usr/bin/bash"
- "-c"
- "while true; do sleep 3600; done"
EOF
here it's using local jq utility
$ oc exec curl-pod -n my-curl-pod-namespace \
-- curl -s \
"http://svc-name.namespace-name.svc.cluster.local/api/v2/books" | jq
Every Pod is assigned a DNS name: pod-ip.namespace-name.pod.cluster.local Every Service is assigned a DNS name: svc-name.namespace-name.svc.cluster.local
$ oc rsh pod-xxx
$ cat /etc/resolv.conf
here it's an example of using an internal commmand with more parameters
$ oc exec curl-pod -n my-curl-pod-namespace \
-- bash -c 'sosreport -h'