Created
March 12, 2021 09:53
-
-
Save yelinaung/d4de7531540e9f2e021a952be0b36899 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
NAME=$1 | |
HOST=$2 | |
PORT=$3 | |
if [ -z "$3" ]; then | |
echo "$0 [name] [ip] [port]" | |
exit 1 | |
fi | |
cat yaml/template.external_endpoints.yml \ | |
| sed "s/ENDPOINTS_NAME/${NAME}/g" \ | |
| sed "s/ENDPOINTS_IP/${HOST}/g" \ | |
| sed "s/ENDPOINTS_PORT/${PORT}/g" \ | |
| kubectl apply -f - | |
cat yaml/template.external_service.yml \ | |
| sed "s/SERVICE_NAME/${NAME}/g" \ | |
| sed "s/SERVICE_IP/${HOST}/g" \ | |
| sed "s/SERVICE_PORT/${PORT}/g" \ | |
| kubectl apply -f - |
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
kind: Endpoints | |
apiVersion: v1 | |
metadata: | |
name: ENDPOINTS_NAME | |
subsets: | |
- addresses: | |
- ip: ENDPOINTS_IP | |
ports: | |
- port: ENDPOINTS_PORT |
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
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: SERVICE_NAME | |
spec: | |
ports: | |
- protocol: TCP | |
port: SERVICE_PORT | |
targetPort: SERVICE_PORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment