k8s-template/README.md

79 lines
3.2 KiB
Markdown
Raw Normal View History

2024-03-21 11:22:35 +00:00
# k8s-template
2024-03-26 04:36:17 +00:00
2024-03-26 06:28:42 +00:00
## What is this?
You can use this template when you create a new lab and deploy it to kubernetes.
- **nginx** : sample software that a content creator wants
- **[traefik](https://doc.traefik.io/traefik/providers/kubernetes-ingress/)** : [ingress controller](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/)
2024-03-26 04:36:17 +00:00
## Sample Workflow
2024-03-26 06:13:31 +00:00
- [ ] **Alice** : Content Creator
- [ ] **Bob** : Lab Administrator
2024-03-26 04:36:17 +00:00
**1. Servers vs Clients**
```
Alice ->> Bob: I'd like to create a new lab for ION.
Bob ->> Alice: Do you want servers or clients?
Alice ->> Bob: I just need a web server that will be shared by learners.
```
2024-03-26 06:13:31 +00:00
> Bob can create diverse types of servers (**Linux only!**) such as, web servers, application servers, and database servers.
Sample server: https://origin-akashop.akamai-lab.com/
2024-03-26 04:36:17 +00:00
>
2024-03-26 06:13:31 +00:00
> Bob can create one type of clients based on **Visual Studio Code**. Clients can be assigned to learners one to one or one to many.
Sample client: https://training.akamai.com/ewp
2024-03-26 04:36:17 +00:00
**2. Software**
```
Bob ->> Alice: Do you have any prefered web server software, like apache or nginx?
Alice ->> Bob: nginx would be good.
Bob ->> Alice: Do you need any other softwares?
2024-03-27 06:52:26 +00:00
Alice ->> Bob: Yes. Please install python3. And I have my own web content files.(html, css, js, images,...)
2024-03-26 04:36:17 +00:00
```
> Bob can install other softwares or tools such as **akamai cli**, based on the lab scenario.
2024-03-26 06:13:31 +00:00
>
2024-03-26 04:36:17 +00:00
> Alice's files will be copied to kubernetes volume(s) later.
**3. Infrastructure**
```
Bob ->> Alice: We use Kubernetes for labs by default. Would it be ok with you?
Alice ->> Bob: What other choices do I have?
2024-03-27 06:52:26 +00:00
Bob ->> Alice: You can select a virtual machine or docker. However, Kubernetes is better when it comes to availability and scalability.
2024-03-26 04:36:17 +00:00
Alice ->> Bob: Alright. I will go with Kubernetes.
```
> Bob will use Kubernetes unless Alice has a compelling reason to use other infrastructure.
**4. Docker Image**
```
Bob ->> Alice: Do you have a custom docker image for this lab?
Alice ->> Bob: No.
Bob ->> Alice: OK. Then I will build a docker image based on public nginx docker image.
```
2024-03-26 06:17:51 +00:00
> Bob builds a docker image and Alice validates it iteratively until they finalize the image. They might need more discussion on the technical details such as, HTTPS, FQDN, port, and etc.
2024-03-26 04:36:17 +00:00
>
> The docker image is not deployed to Kubernetes in this stage.
**5. Staging**
> Bob builds kubernetes yaml files and Alice validates them iteratively until they finalize the yaml files. They might need more discussion on the technical details such as health check, auto scaling, persistent volume, and etc.
>
> The yaml files are applied to Kubernetes staging environment.
2024-03-26 06:13:31 +00:00
>
> All files (Dockerfile, Alice's files, yaml files) are saved in Gitea repository. (https://gitea-ptl.akamai-lab.com)
2024-03-26 04:36:17 +00:00
**6. Production**
2024-03-26 06:17:51 +00:00
> Bob clones the Gitea project and applies all files to kubernetes production environment.
2024-03-26 06:28:42 +00:00
```
git clone https://gitea-ptl.akamai-lab.com/akamai/k8s-template.git
cd traefik
kubectl apply -f 00-account.yml -f 00-role.yml -f 01-role-binding.yml -f 02-traefik.yml -f 02-traefik-services.yml
cd ../nginx
2024-03-27 06:52:26 +00:00
kubectl apply -f nginx-deployemt.yml -f nginx-service.yml -f nginx-ext.yml -f nginx-ingress.yml -f pv.yml -f pvc.yml
2024-03-26 06:28:42 +00:00
```
2024-03-26 06:17:51 +00:00
> Alice validates the environment by end-to-end test.