-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rather than hugo, which I really don't know much about and don't care to maintain, it now is just a trivial HTTP server (python) serving content from this repo.
- Loading branch information
Showing
14 changed files
with
76 additions
and
155 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,25 @@ | ||
# git-blog-demo | ||
# git-sync-demo | ||
|
||
This demo shows how to use the `git-sync` sidekick container along side `volumes` and `volumeMounts` to create a markdown powered blog. | ||
This demo shows how to use a `git-sync` container alongside an HTTP server to | ||
serve static content. | ||
|
||
## How it works | ||
|
||
The pod is composed of 3 containers that share directories using 2 volumes: | ||
The pod is composed of 2 containers that share a volume. | ||
|
||
- The `git-sync` container clones a git repo into the `markdown` volume | ||
- The `hugo` container read from the `markdown` volume and render it into the `html` volume. | ||
- The `nginx` container serve the content from the `html` volume. | ||
- The `git-sync` container clones a git repo into the `content` volume | ||
- The `http` container serves that content | ||
|
||
## Usage | ||
|
||
### Build demo containers (Optional) | ||
|
||
Build the demo containers, and push them to a registry | ||
|
||
``` | ||
docker build -t <some-registry>/git-sync .. | ||
docker build -t <some-registry>/hugo hugo/ | ||
docker push <some-registry>/hugo <some-registry>/git-sync | ||
``` | ||
For the purposes of this demo, it's about as trivial as it can get. | ||
|
||
If you end up using a different registry, be sure to update `config/deployment.yaml`. | ||
|
||
### | ||
## Usage | ||
|
||
Create the pod and the service for the blog | ||
Apply the deployment and the service files: | ||
|
||
``` | ||
kubectl create -f config | ||
kubectl apply -f deployment.yaml | ||
kubectl apply -f service.yaml | ||
``` | ||
|
||
Open the service external ip in your browser | ||
Wait for the service to be assigned a LoadBalancer IP, then open that IP in | ||
your browser. |
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: static-server | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: static-server | ||
template: | ||
metadata: | ||
labels: | ||
app: static-server | ||
spec: | ||
volumes: | ||
- name: content | ||
emptyDir: {} | ||
containers: | ||
# This container pulls a git repo into the "content" volume. If this | ||
# were a "real" app it would probably have livenessProbe and resources, | ||
# and maybe a secret to get credentials for your git server. | ||
- name: git-sync | ||
image: registry.k8s.io/git-sync/git-sync:v4.2.3 | ||
args: | ||
- --repo=https://github.com/kubernetes/git-sync | ||
- --root=/git | ||
- --period=60s | ||
- --link=head | ||
- --max-failures=1000000000 | ||
- -v=2 | ||
volumeMounts: | ||
- name: content | ||
mountPath: /git | ||
# This container is a trivial HTTP server for the content. | ||
# If this were a "real" app it would not be so trivial. For example, | ||
# nginx or apache are much more robust web servers! It's missing a | ||
# livenessProbe, resources, and many other things you would want for | ||
# running in production. Also, you would probably have a git repo | ||
# dedicated to holding your content. | ||
- name: http | ||
image: python:alpine | ||
args: | ||
- python3 | ||
- -m | ||
- http.server | ||
- -d=/git/head/demo/html | ||
volumeMounts: | ||
- name: content | ||
mountPath: /git | ||
readOnly: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
|
||
<h1>That's it, that's the demo</h1> | ||
<p>Impressive, right?</p> | ||
|
||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: blog-service | ||
name: static-server | ||
spec: | ||
selector: | ||
app: static-server | ||
type: LoadBalancer | ||
ports: | ||
- port: 80 | ||
selector: | ||
name: blog | ||
targetPort: 8000 |