AATHITH RAJENDRAN
AATHITH RAJENDRAN

Reputation: 5366

Create Kubernetes object from a file located in Github

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?

Upvotes: 1

Views: 1620

Answers (1)

VonC
VonC

Reputation: 1324258

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

Upvotes: 3

Related Questions