Created
July 5, 2023 10:36
-
-
Save fadulalla/df46308cd2570a878be20010745ed416 to your computer and use it in GitHub Desktop.
Port forwarding pod for internal AWS services yaml config file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
annotations: {} | |
name: mgmt-pod | |
namespace: <namespace> # update | |
spec: | |
containers: | |
- command: | |
- /bin/bash | |
- -ec | |
- 'apt-get update -y && apt-get install -y socat && socat tcp-listen:$LOCAL_PORT,reuseaddr,fork | |
tcp:$REMOTE_HOST:$REMOTE_PORT & pid=$! && trap ''kill $pid'' SIGINT && echo | |
''Socat started listening on $LOCAL_PORT: Redirecting traffic to $REMOTE_HOST:$REMOTE_PORT | |
($pid)'' && wait $pid' | |
env: | |
- name: REMOTE_HOST | |
value: <internal_aws_service_endpoint> # update | |
- name: LOCAL_PORT | |
value: "11433" # update. port on local machine | |
- name: REMOTE_PORT | |
value: "1433" # update. actual service port on aws. | |
image: ubuntu:latest | |
imagePullPolicy: Always | |
name: mgmt-pod-container | |
restartPolicy: Never |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment