Create Kubernetes object from a file located in Github

2/8/2020

I want to create a deployment with GitHub URL using
kubectl create -f github.com/deployment.yaml
That deployment.yaml file is located in my private GitHub repository.
How can I authenticate my kubectl to use my GitHub private repo and create that deployment?

-- AATHITH RAJENDRAN
github
kubectl
kubernetes
kubernetes-deployment

1 Answer

2/8/2020

You could simply:

That is, from this example:

USER="me"
PASSWD="mypasswd"
OUTPUT_FILEPATH="./foo"
OWNER="mycompany"
REPOSITORY="boo"
RESOURCE_PATH="project-x/a/b/c.py"
TAG="my_unit_test"
curl \
    -u "$USER:$PASSWD" \
    -H 'Accept: application/vnd.github.v4.raw' \
    -o "$OUTPUT_FILEPATH" \
    -L "https://api.github.com/repos/$OWNER/$REPOSITORY/contents/$RESOURCE_PATH?ref=$TAG"
| kubectl create -f /dev/stdin
-- VonC
Source: StackOverflow