03 Kubectl and Helm -- HANDIN QUESTIONS
:::info Use this page to hand in the assignment on Leho. It only contains the questions you should fill in. :::
:::success
QUESTION Search the Kubernetes documentation for the explanation of the Single/Many Node Read-Write/Read-Only. Explain in your own words:
The difference between these options is:
* single Node Read-Write: this volume can only be accessed by 1 node, but still by several pods from this same node. Both reading and writing is possible.
* Many Nodes Read-Only: this volume is accessible from several nodes, but only reading is possible
* Many Nodes Read-Write: same as previous but als writing is possible
* Another option, that was not available is ReadWriteOncePod: here only one pod from the cluster can access it for reading and/or writing.
:::
:::success
QUESTION Locate the files on your virtual machine, and give the command(s) that you executed to find these files. Explain in your own words how you found the files, or why they are there ...
// Answer here
1) My files were under `/mnt/data`
2) I have executed these commands:
* cd /
* cd mnt/data
* ls
* cd MUSIC
* ls
...
3) My files were there because they are not saved inside the pod but in a persistent volume that is mounted to /mnt/data of my host machine
:::
:::success
QUESTION Which command do you use to: List all your deployments, get the IP address of a service TIP: You can use the --namespace segers-nathan-courses flag to get only the specific resources in one specific namespace.
// Answer here
// List all your deployments
=> kubectl get deployments -n lefebvre-greet-courses
// Get the IP address of a service
=> kubectl get services -n lefebvre-greet-courses
:::
:::success
QUESTION The commands I used:
// Scale my deployment
=> kubectl scale deployment/lefeb-gr-frontend --replicas=2 -n lefebvre-greet-courses
// Upgrade my app to a new (or old version)
=> kubectl set image deployment/lefeb-gr-python-api api="ghcr.io/greet-lefebvre/fastapi-intro:v2.1" -n lefebvre-greet-courses
en vervolgens:
==> kubectl rollout restart deployment/lefeb-gr-python-api -n lefebvre-greet-courses
:::
:::success
QUESTION The command I used to deploy this file was:
=> kubectl apply -f mct-courses-frontend.yaml -n lefebvre-greet-courses
:::
:::success
QUESTION What is the Repository, Chart name and Release name in the command executed above?
Repository: howest
Release name: helm-demo
Chart name: example-v2
:::
:::warning
QUESTION (Harder level) Take a look at the charts/example-v2/templates/tests/test-connection.yaml (down here) Write in your own words what this file does.
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "example.fullname" . }}-test-connection"
labels:
{{ include "example.labels" . | indent 4 }}
annotations:
"helm.sh/hook": test-success
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "example.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
// Write your answer here
The test-connection.yaml file makes a test for the generated helm-charts. It can be activated with "helm test <deployment>". At that moment, a connectiontest will be executed to the port configuered in the service
:::
:::success
QUESTION Paste your own adapted helm-values.yaml with the right nodeSelector and imagePullSecrets below
replicaCount: 2
# Paste answer here
image:
repository: ghcr.io/greet-lefebvre/fastapi-intro # You can keep this on my image, because of the Pull Secrets
tag: v2.1
nameOverride: "greet-fastapi"
fullNameOverride: "greet-fastapi-demo"
serviceAccount:
create: true
name: helm-service-account ## This is a name you can choose yourself
## Keep these empty for the first try.
imagePullSecrets: # Here you can fill in your own Pull Secret if you do want to work with your own repository
- name: secret-fastapi-helm
nodeSelector: # Fill in the right Node Selector here.
kubernetes.io/hostname: lefebvre-greet
:::
What did you learn?
Fill in something that you learned during this lesson
* digging into online documentation
* using persistent volumes
* have an idea what helmcharts are used for ==> more practice is needed
Give three interesting exam questions
* give an application where the use of helmcharts is recommended
* you have a logging application with 1 replica running on a cluster with several nodes. Only the last hour of logging must be stored. Do you need a persistent storage? yes/no and why?
* give the command to result in the output below:
NAME CHART VERSION APP VERSION DESCRIPTION
howest/alpine 0.1.2 3.9 Deploy a basic Alpine Linux pod
howest/dependencies 0.1.0 1.0 Chart to test dependencies
howest/dependencies-v1 0.1.8 1.0 Chart to test dependencies
howest/dependencies-v2 0.1.8 1.0 Chart to test dependencies
howest/example 0.1.2 1.0 A Helm chart for Kubernetes
howest/example-v1 0.1.11 3.9 Deploy a basic Alpine Linux pod
howest/example-v2 0.2.7 1.0 A Helm chart for Kubernetes
Handing in this assignment
This assignment has to be handed in the 5th of December 2021. You will hand this in by downloading this document through the ... in the upper-right corner. Download as markdown and fill in the answers to the questions.
You can hand in as a markdown (.md) file, or create a PDF of it. The easiest way to create a PDF is to paste your markdown file into a new HackMD page, and to print that page to PDF.
Hand in with this URL: Deadline: 05/12/2021 23:59
Checkboxes:
x I have downloaded this as a markdown file
x I have filled in all the answers
x I have added something that I learned
x I have added three interesting exam questions
x I have made a Kubernetes namespace / Rancher project called:
* storage: lefebre-greet-storage
* helm: lefebvre-greet-helm