-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module 14 #18
base: main
Are you sure you want to change the base?
Module 14 #18
Changes from all commits
a769ffa
09b19d9
f318377
3a92ff1
abfb7e5
c824097
ecdb69f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,3 +160,6 @@ override.tf.json | |
# Ignore CLI configuration files | ||
.terraformrc | ||
terraform.rc | ||
|
||
#k8s | ||
secrets.yaml |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,4 +130,35 @@ LOG_LEVEL is set as an environmental Variable and can be edited to the below val | |
* WARNING | ||
* ERROR | ||
|
||
|
||
|
||
# MiniKube Set up | ||
To configure a local minikube deployment of the todo-app. Assuming Docker desktop and Minikube are set up locally. | ||
|
||
### secret.yaml base format | ||
there is a secrets_.yaml file supplied with the code - enter required values as specified and rename to secrets.yaml | ||
|
||
### Build base Docker Image | ||
`docker build --target production --tag todo-app:minikube.1 .` | ||
|
||
## Kubernetes/Minikube Deployment | ||
Load docker image to minikube cache | ||
`minikube image load todo-app:minikube.1` | ||
Start the deployments of services and files | ||
`kubectl apply -f secrets.yaml` | ||
`kubectl apply -f deployment.yaml` | ||
`kubectl apply -f service.yaml` | ||
|
||
start port forwarding of local ports to container | ||
`kubectl port-forward service/todo-app 5000:5000` | ||
|
||
The todoapp web site should now be accessible on localhost:5000 running from local minikube cluster | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lots of whitespace here |
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# deployment.yaml | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: todo-app | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: todo-app | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: todo-app | ||
spec: | ||
containers: | ||
- name: todo-app | ||
image: todo-app:minikube.1 | ||
env: | ||
- name: CLIENT_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: my-secrets | ||
key: CLIENT_ID | ||
- name: CLIENT_SECRET | ||
valueFrom: | ||
secretKeyRef: | ||
name: secrets | ||
key: CLIENT_SECRET | ||
- name: SECRET_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: secrets | ||
key: SECRET_KEY | ||
- name: CONNECTION_STRING | ||
valueFrom: | ||
secretKeyRef: | ||
name: secrets | ||
key: CONNECTION_STRING | ||
- name: LOGGLY_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: secrets | ||
key: LOGGLY_TOKEN | ||
- name: PORT | ||
value: '5000' | ||
imagePullPolicy: Never | ||
ports: | ||
- containerPort: 5000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#unpopulated secrets.yaml file. Populate and rename to secrets.yaml before deploying to minikube | ||
|
||
Comment on lines
+1
to
+2
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: the name could follow the convention similar to |
||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: secrets | ||
type: Opaque | ||
data: | ||
CLIENT_ID: <github_client_id_here> | ||
CLIENT_SECRET: <github_client secret here> | ||
SECRET_KEY: <secretkey here> | ||
CONNECTION_STRING: <connection string here to a mongodb> | ||
#LOGGLY_TOKEN: <loggly token> # optional for external logging to loggly | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: I don't think this needs to be commented out. It's clear from the inline comment later that this is optional, but leaving it empty should do the trick as well |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# service.yaml | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: todo-app | ||
spec: | ||
type: NodePort | ||
selector: | ||
app: todo-app | ||
ports: | ||
- protocol: TCP | ||
port: 5000 | ||
targetPort: 5000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the phrasing here, because it looks a bit grammatically incorrect