-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jbris
committed
Dec 12, 2023
1 parent
0fb1674
commit b02ef17
Showing
31 changed files
with
550 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
mkdir -p configure-pod-container/configmap/ | ||
|
||
wget https://kubernetes.io/examples/configmap/game.properties -O configure-pod-container/configmap/game.properties | ||
wget https://kubernetes.io/examples/configmap/ui.properties -O configure-pod-container/configmap/ui.properties | ||
|
||
kubectl create configmap game-config --from-file=configure-pod-container/configmap/ | ||
|
||
kubectl describe configmaps game-config | ||
|
||
kubectl get configmaps game-config -o yaml | ||
|
||
kubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties | ||
|
||
kubectl create configmap game-config-2 --from-file=configure-pod-container/configmap/game.properties --from-file=configure-pod-container/configmap/ui.properties | ||
|
||
kubectl create configmap game-config-env-file \ | ||
--from-env-file=configure-pod-container/configmap/game-env-file.properties | ||
|
||
kubectl get configmap config-multi-env-files -o yaml | ||
|
||
kubectl apply -k . |
5 changes: 5 additions & 0 deletions
5
config/configure-pod-container/configmap/game-env-file.properties
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,5 @@ | ||
enemies=aliens | ||
lives=3 | ||
allowed="true" | ||
|
||
# This comment and the empty line above it are ignored |
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,7 @@ | ||
enemies=aliens | ||
lives=3 | ||
enemies.cheat=true | ||
enemies.cheat.level=noGoodRotten | ||
secret.code.passphrase=UUDDLRLRBABAS | ||
secret.code.allowed=true | ||
secret.code.lives=30 |
3 changes: 3 additions & 0 deletions
3
config/configure-pod-container/configmap/ui-env-file.properties
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,3 @@ | ||
color=purple | ||
textmode=true | ||
how=fairlyNice |
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,4 @@ | ||
color.good=purple | ||
color.bad=yellow | ||
allow.textmode=true | ||
how.nice.to.look=fairlyNice |
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,7 @@ | ||
configMapGenerator: | ||
- name: game-config-4 | ||
options: | ||
labels: | ||
game-config: config-4 | ||
files: | ||
- configure-pod-container/configmap/game.properties |
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,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
kubectl create secret generic empty-secret | ||
kubectl get secret empty-secret |
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,8 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: secret-dockercfg | ||
type: kubernetes.io/dockercfg | ||
data: | ||
.dockercfg: | | ||
eyJhdXRocyI6eyJodHRwczovL2V4YW1wbGUvdjEvIjp7ImF1dGgiOiJvcGVuc2VzYW1lIn19fQo= |
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,27 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: dotfile-secret | ||
data: | ||
.secret-file: dmFsdWUtMg0KDQo= | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: secret-dotfiles-pod | ||
spec: | ||
volumes: | ||
- name: secret-volume | ||
secret: | ||
secretName: dotfile-secret | ||
containers: | ||
- name: dotfile-test-container | ||
image: registry.k8s.io/busybox | ||
command: | ||
- ls | ||
- "-l" | ||
- "/etc/secret-volume" | ||
volumeMounts: | ||
- name: secret-volume | ||
readOnly: true | ||
mountPath: "/etc/secret-volume" |
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,17 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: mypod | ||
spec: | ||
containers: | ||
- name: mypod | ||
image: redis | ||
volumeMounts: | ||
- name: foo | ||
mountPath: "/etc/foo" | ||
readOnly: true | ||
volumes: | ||
- name: foo | ||
secret: | ||
secretName: mysecret | ||
optional: 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 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: secret-sa-sample | ||
annotations: | ||
kubernetes.io/service-account.name: "sa-name" | ||
type: kubernetes.io/service-account-token | ||
data: | ||
extra: YmFyCg== |
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,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
kubectl apply -f service/load-balancer-example.yaml | ||
|
||
kubectl get deployments hello-world | ||
kubectl describe deployments hello-world | ||
|
||
kubectl get replicasets | ||
kubectl describe replicasets | ||
|
||
kubectl expose deployment hello-world --type=LoadBalancer --name=my-service | ||
|
||
kubectl get services my-service | ||
|
||
kubectl describe services my-service | ||
|
||
kubectl get pods --output=wide |
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,21 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: load-balancer-example | ||
name: hello-world | ||
spec: | ||
replicas: 5 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: load-balancer-example | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: load-balancer-example | ||
spec: | ||
containers: | ||
- image: gcr.io/google-samples/node-hello:1.0 | ||
name: hello-world | ||
ports: | ||
- containerPort: 8080 |
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,29 @@ | ||
# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: frontend | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: guestbook | ||
tier: frontend | ||
template: | ||
metadata: | ||
labels: | ||
app: guestbook | ||
tier: frontend | ||
spec: | ||
containers: | ||
- name: php-redis | ||
image: gcr.io/google_samples/gb-frontend:v5 | ||
env: | ||
- name: GET_HOSTS_FROM | ||
value: "dns" | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 100Mi | ||
ports: | ||
- containerPort: 80 |
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,19 @@ | ||
# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: frontend | ||
labels: | ||
app: guestbook | ||
tier: frontend | ||
spec: | ||
# if your cluster supports it, uncomment the following to automatically create | ||
# an external load-balanced IP for the frontend service. | ||
# type: LoadBalancer | ||
#type: LoadBalancer | ||
ports: | ||
# the port that this service should serve on | ||
- port: 80 | ||
selector: | ||
app: guestbook | ||
tier: frontend |
30 changes: 30 additions & 0 deletions
30
php_redis/application/guestbook/redis-follower-deployment.yaml
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,30 @@ | ||
# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: redis-follower | ||
labels: | ||
app: redis | ||
role: follower | ||
tier: backend | ||
spec: | ||
replicas: 2 | ||
selector: | ||
matchLabels: | ||
app: redis | ||
template: | ||
metadata: | ||
labels: | ||
app: redis | ||
role: follower | ||
tier: backend | ||
spec: | ||
containers: | ||
- name: follower | ||
image: gcr.io/google_samples/gb-redis-follower:v2 | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 100Mi | ||
ports: | ||
- containerPort: 6379 |
17 changes: 17 additions & 0 deletions
17
php_redis/application/guestbook/redis-follower-service.yaml
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,17 @@ | ||
# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: redis-follower | ||
labels: | ||
app: redis | ||
role: follower | ||
tier: backend | ||
spec: | ||
ports: | ||
# the port that this service should serve on | ||
- port: 6379 | ||
selector: | ||
app: redis | ||
role: follower | ||
tier: backend |
30 changes: 30 additions & 0 deletions
30
php_redis/application/guestbook/redis-leader-deployment.yaml
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,30 @@ | ||
# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: redis-leader | ||
labels: | ||
app: redis | ||
role: leader | ||
tier: backend | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: redis | ||
template: | ||
metadata: | ||
labels: | ||
app: redis | ||
role: leader | ||
tier: backend | ||
spec: | ||
containers: | ||
- name: leader | ||
image: "docker.io/redis:6.0.5" | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 100Mi | ||
ports: | ||
- containerPort: 6379 |
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,17 @@ | ||
# SOURCE: https://cloud.google.com/kubernetes-engine/docs/tutorials/guestbook | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: redis-leader | ||
labels: | ||
app: redis | ||
role: leader | ||
tier: backend | ||
spec: | ||
ports: | ||
- port: 6379 | ||
targetPort: 6379 | ||
selector: | ||
app: redis | ||
role: leader | ||
tier: backend |
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,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
kubectl apply -f application/guestbook/redis-leader-deployment.yaml | ||
|
||
kubectl apply -f application/guestbook/redis-leader-service.yaml | ||
|
||
kubectl apply -f application/guestbook/redis-follower-deployment.yaml | ||
|
||
kubectl apply -f application/guestbook/redis-follower-service.yaml | ||
|
||
kubectl apply -f application/guestbook/frontend-deployment.yaml | ||
|
||
kubectl apply -f application/guestbook/frontend-service.yaml | ||
|
||
kubectl get pods -l app=guestbook -l tier=frontend | ||
|
||
kubectl get pods | ||
|
||
# kubectl logs -f deployment/redis-leader | ||
|
||
kubectl port-forward svc/frontend 8080:80 | ||
|
||
kubectl get service | ||
|
||
kubectl get service frontend |
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,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
kubectl scale deployment frontend --replicas=5 |
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,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
kubectl apply -f example-redis-config.yaml | ||
|
||
kubectl apply -f https://raw.githubusercontent.com/kubernetes/website/main/content/en/examples/pods/config/redis-pod.yaml |
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,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
kubectl delete pod/redis configmap/example-redis-config | ||
|
||
kubectl delete pod redis | ||
|
||
kubectl delete pod/redis configmap/example-redis-config |
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,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
kubectl get pod/redis configmap/example-redis-config | ||
|
||
kubectl describe configmap/example-redis-config | ||
|
||
kubectl exec -it redis -- redis-cli | ||
|
||
# CONFIG GET maxmemory | ||
|
||
kubectl apply -f pods/config/example-redis-config.yaml |
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,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: example-redis-config | ||
data: | ||
redis-config: | | ||
maxmemory 2mb | ||
maxmemory-policy allkeys-lru |
Oops, something went wrong.