├── 101 ├── README.md ├── images │ ├── borg-cluster.png │ ├── borg.jpg │ ├── docker-logo.png │ ├── docker-package-software.png │ ├── docker.svg │ ├── kubernetes-cloud-cluster.png │ ├── kubernetes-cluster.png │ ├── kubernetes-comic.png │ ├── kubernetes-greek-etymology.png │ ├── kubernetes-logo.png │ ├── kubernetes-node.svg │ ├── microservices.png │ ├── obligatory-cointainer-boat-photo.png │ ├── pod.svg │ ├── pods-network.png │ ├── pods-storage.png │ ├── pods.svg │ ├── servers-pets-vs-cattle.jpg │ ├── servers-to-serverless.png │ └── services.svg ├── kubernetes-101.slide ├── labs │ ├── README.md │ └── app │ │ ├── app-v1 │ │ ├── Dockerfile │ │ ├── Makefile │ │ └── app.go │ │ └── app-v2 │ │ ├── Dockerfile │ │ ├── Makefile │ │ └── app.go └── yml │ ├── deployment-resources.yml │ ├── pod-health-cmd-readiness.yml │ ├── pod-health-http-liveness.yml │ ├── pod-health-tcp-both.yml │ ├── pod-multi.yml │ ├── pod-selector-equality.yml │ ├── pod-selector-set.yml │ ├── pod-single.yml │ ├── replicaset-deployment.yml │ ├── replicaset-hpa.yml │ └── replicaset-selector-set.yml ├── .dockerignore ├── .gitignore ├── Dockerfile ├── Makefile ├── README.md ├── clouds ├── README.md ├── images │ ├── aks.png │ ├── demo.png │ ├── eks.png │ ├── gke.png │ └── virtual-kubelet.svg ├── kubernetes-clouds.slide └── labs │ ├── README.md │ ├── aws │ ├── README.md │ └── eks │ │ ├── cloudformation │ │ └── eks-nodegroup-cf-stack.yaml │ │ ├── iam │ │ └── AmazonEKSServiceRole.json │ │ ├── manifests │ │ ├── eks-admin-binding-role.yaml │ │ ├── eks-admin-service-account.yaml │ │ ├── eks-kubeconfig.yaml │ │ ├── k8s-aws-auth-cm.yaml │ │ └── manifests │ │ │ ├── eks-admin-binding-role.yaml │ │ │ ├── eks-admin-service-account.yaml │ │ │ ├── eks-kubeconfig.yaml │ │ │ └── k8s-aws-auth-cm.yaml │ │ └── route53 │ │ └── CustomRoute53RecordSet.json │ ├── azure │ └── README.md │ ├── demo-app │ ├── README.md │ ├── app │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── Makefile │ │ ├── main.go │ │ └── public │ │ │ ├── index.html │ │ │ ├── k8s-for-all.jpg │ │ │ ├── script.js │ │ │ └── style.css │ ├── guestbook-page.png │ └── k8s │ │ ├── guestbook-deployment.yml │ │ ├── guestbook-service.yml │ │ ├── redis-master-deployemt.yml │ │ ├── redis-master-service.yml │ │ └── redis-slave.yml │ └── gcp │ └── README.md ├── course ├── README.md ├── containers │ ├── README.md │ ├── labs │ │ ├── 01-Namespaces-and-CGroups │ │ │ └── README.md │ │ ├── 02-Docker │ │ │ ├── 02.1-hello-world │ │ │ │ ├── README.md │ │ │ │ ├── v1 │ │ │ │ │ ├── Dockerfile │ │ │ │ │ └── Makefile │ │ │ │ ├── v2 │ │ │ │ │ ├── Dockerfile │ │ │ │ │ └── Makefile │ │ │ │ └── v3 │ │ │ │ │ ├── Dockerfile │ │ │ │ │ └── Makefile │ │ │ ├── 02.2-hello-world-go │ │ │ │ ├── README.md │ │ │ │ ├── v1 │ │ │ │ │ ├── Dockerfile │ │ │ │ │ ├── Makefile │ │ │ │ │ └── app.go │ │ │ │ └── v2 │ │ │ │ │ ├── Dockerfile │ │ │ │ │ ├── Makefile │ │ │ │ │ └── app.go │ │ │ ├── 02.3-hello-world-nginx │ │ │ │ ├── Dockerfile │ │ │ │ ├── Makefile │ │ │ │ ├── README.md │ │ │ │ └── ctx │ │ │ │ │ ├── hello.conf │ │ │ │ │ └── index.html │ │ │ └── Extra.md │ │ └── 03-Docker-Compose │ │ │ └── 03.1-wordpress │ │ │ ├── README.md │ │ │ ├── docker-compose.yaml │ │ │ └── wordpress-copy.yaml │ └── slides │ │ └── README.md ├── kubernetes │ ├── README.md │ ├── labs │ │ ├── 00-Kind │ │ │ └── README.md │ │ ├── 01-Pods │ │ │ ├── 01.1-Basics │ │ │ │ ├── README.md │ │ │ │ ├── busybox-0.yaml │ │ │ │ ├── busybox-100.yaml │ │ │ │ ├── busybox-30.yaml │ │ │ │ ├── hello-sh-updated.yaml │ │ │ │ ├── hello-sh.yaml │ │ │ │ ├── hello-web.yml │ │ │ │ ├── pod-selector-equality.yml │ │ │ │ ├── pod-selector-set.yml │ │ │ │ └── shell.yaml │ │ │ ├── 01.2-Resources │ │ │ │ ├── busybox-resources-0.yaml │ │ │ │ ├── busybox-resources-10.yaml │ │ │ │ ├── busybox-resources-limits.yaml │ │ │ │ ├── busybox-resources-requests-unschedulable.yaml │ │ │ │ ├── busybox-resources-requests.yaml │ │ │ │ └── busybox-resources.yaml │ │ │ ├── 01.3-Multi │ │ │ │ ├── README.md │ │ │ │ ├── nginx-and-shell-network.yaml │ │ │ │ ├── nginx-and-shell-volume.yaml │ │ │ │ └── pod-multi.yml │ │ │ ├── 01.4-lifecycle │ │ │ │ ├── README.md │ │ │ │ ├── busybox-probes-readiness-ko.yml │ │ │ │ ├── busybox-probes-readiness-ok.yml │ │ │ │ ├── pod-health-cmd-readiness.yml │ │ │ │ ├── pod-health-http-liveness.yml │ │ │ │ └── pod-health-tcp-both.yml │ │ │ └── 01.5-init-containers │ │ │ │ ├── README.md │ │ │ │ ├── busybox-init-containers-dummy-svc.yaml │ │ │ │ └── busybox-init-containers.yml │ │ ├── 02-ReplicaSets │ │ │ ├── 101_simple-rs.yaml │ │ │ ├── 201_simple-rs-5.yaml │ │ │ ├── 202_simple-rs-50.yaml │ │ │ ├── 203_simple-rs-pods.yaml │ │ │ ├── 301_simple-blue-pods.yaml │ │ │ ├── 302_simple-blue-rs.yaml │ │ │ ├── 303_simple-red-pods.yaml │ │ │ ├── 304_simple-rs-nocolor-update.yaml │ │ │ ├── 305_simple-nocolor-rs.yaml │ │ │ ├── 306_simple-orange-pods.yaml │ │ │ ├── 307_simple-orange-rs.yaml │ │ │ ├── 400_probes-rs-readiness.yaml │ │ │ ├── 401_probes-rs-readiness-ko.yaml │ │ │ ├── 402_probes-rs-liveness.yaml │ │ │ ├── 403_probes-rs-liveness-ko.yaml │ │ │ ├── 501_probes-images-rs.yaml │ │ │ ├── 502_probes-images-rs-update-image-ko.yaml │ │ │ ├── 503_probes-images-rs-6-update-image-ko.yaml │ │ │ ├── 504_probes-images-rs-9-update-image-ok.yaml │ │ │ ├── 505_probes-images-rs-6-update-image-ok.yaml │ │ │ ├── 506_probes-images-rs-update-selector.yaml │ │ │ ├── 507_probes-images-v2.0-rs.yaml │ │ │ ├── 508_probes-images-scale-down-both-rs.yaml │ │ │ ├── 509_probes-images-scale-up-both-rs.yaml │ │ │ └── README.md │ │ ├── 03-Storage │ │ │ ├── 03.1-ConfigMaps │ │ │ │ └── shell │ │ │ │ │ ├── README.md │ │ │ │ │ ├── game-config-configmap-v2.yaml │ │ │ │ │ ├── game-config-configmap.yaml │ │ │ │ │ ├── game-env-configmap.yaml │ │ │ │ │ └── pod.yaml │ │ │ ├── 03.2-Secrets │ │ │ │ ├── README.md │ │ │ │ ├── secret.yaml │ │ │ │ └── shell.yaml │ │ │ ├── 03.3-Volumes │ │ │ │ ├── README.md │ │ │ │ ├── pvc.yaml │ │ │ │ └── shell.yaml │ │ │ └── 03.4-DownardAPI │ │ │ │ ├── README.md │ │ │ │ └── shell.yaml │ │ ├── 04-Deployments │ │ │ ├── 04.1-replicaset │ │ │ │ ├── README.md │ │ │ │ ├── cats-replicaset.yaml │ │ │ │ ├── lia-rs.yaml │ │ │ │ ├── liam-rs.yaml │ │ │ │ └── service.yaml │ │ │ ├── 04.2-deployment │ │ │ │ ├── 01-cats │ │ │ │ │ ├── README.md │ │ │ │ │ ├── cats.yaml │ │ │ │ │ ├── lia.yaml │ │ │ │ │ ├── liam.yaml │ │ │ │ │ └── service.yml │ │ │ │ ├── 02-kubernetes-dashboard │ │ │ │ │ ├── README.md │ │ │ │ │ └── cluster-admin-dashboard-rbac.yaml │ │ │ │ ├── 03-guestbook │ │ │ │ │ ├── README.md │ │ │ │ │ ├── app-v1 │ │ │ │ │ │ ├── .gitignore │ │ │ │ │ │ ├── Dockerfile │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── main.go │ │ │ │ │ │ └── public │ │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ │ ├── script.js │ │ │ │ │ │ │ ├── style.css │ │ │ │ │ │ │ └── upc.png │ │ │ │ │ ├── app-v2 │ │ │ │ │ │ ├── .gitignore │ │ │ │ │ │ ├── Dockerfile │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── main.go │ │ │ │ │ │ └── public │ │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ │ ├── script.js │ │ │ │ │ │ │ ├── style.css │ │ │ │ │ │ │ └── upc.png │ │ │ │ │ ├── app-v3 │ │ │ │ │ │ ├── .gitignore │ │ │ │ │ │ ├── Dockerfile │ │ │ │ │ │ ├── Makefile │ │ │ │ │ │ ├── main.go │ │ │ │ │ │ └── public │ │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ │ ├── script.js │ │ │ │ │ │ │ ├── style.css │ │ │ │ │ │ │ └── upc.png │ │ │ │ │ ├── guestbook-page.png │ │ │ │ │ ├── k8s-v2 │ │ │ │ │ │ └── guestbook-deployment.yml │ │ │ │ │ ├── k8s │ │ │ │ │ │ ├── guestbook-deployment.yml │ │ │ │ │ │ ├── guestbook-service.yml │ │ │ │ │ │ ├── redis-master-deployemt.yml │ │ │ │ │ │ ├── redis-master-service.yml │ │ │ │ │ │ └── redis-slave.yml │ │ │ │ │ └── terraform.tfstate │ │ │ │ └── 04-wordpress │ │ │ │ │ ├── README.md │ │ │ │ │ ├── mysql-credentials-secret.yaml │ │ │ │ │ ├── mysql-deployment-pvc.yaml │ │ │ │ │ ├── mysql-deployment.yaml │ │ │ │ │ └── wordpress-deployment.yaml │ │ │ ├── 04.3-statefulset │ │ │ │ ├── README.md │ │ │ │ ├── mysql-credentials-secret.yaml │ │ │ │ ├── mysql-sts.yaml │ │ │ │ └── wordpress-deployment.yaml │ │ │ ├── 04.4-daemonset │ │ │ │ ├── README.md │ │ │ │ ├── hostname-ds.yaml │ │ │ │ └── hostname-v2-ds.yaml │ │ │ ├── 04.5-jobs │ │ │ │ ├── README.md │ │ │ │ ├── cronjob.yaml │ │ │ │ ├── job-5.yaml │ │ │ │ └── job-manual.yaml │ │ │ ├── 04.6-affinity-and-antiaffinity │ │ │ │ ├── README.md │ │ │ │ ├── hostname-affinity-deployment.yaml │ │ │ │ ├── hostname-antiaffinity-deployment.yaml │ │ │ │ ├── hostname-node-selector-deployment.yaml │ │ │ │ └── hostname-toleration-deployment.yaml │ │ │ ├── 04.8-application-bundles │ │ │ │ ├── 01-kubernetes-dashboard │ │ │ │ │ ├── README.md │ │ │ │ │ └── cluster-admin-dashboard-rbac.yaml │ │ │ │ ├── 02-helm-hello │ │ │ │ │ ├── .gitignore │ │ │ │ │ └── README.md │ │ │ │ ├── 03-helm+operators │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── README.md │ │ │ │ │ ├── guestbook-http-ingress.yaml │ │ │ │ │ ├── guestbook-letsencrypt-production-ingress.yaml │ │ │ │ │ ├── guestbook-selfsigned-ingress.yaml │ │ │ │ │ ├── guestbook │ │ │ │ │ │ ├── guestbook-deployment.yml │ │ │ │ │ │ ├── guestbook-service.yml │ │ │ │ │ │ ├── redis-master-deployemt.yml │ │ │ │ │ │ ├── redis-master-service.yml │ │ │ │ │ │ └── redis-slave.yml │ │ │ │ │ ├── hello+guestbook-selfsigned-ingress.yaml │ │ │ │ │ ├── hello-selfsigned+guestbook-selfsigned-ingress.yaml │ │ │ │ │ ├── letsencrypt-production-clusterissuer.yaml │ │ │ │ │ └── selfsigned-clusterissuer.yaml │ │ │ │ ├── 04-helm+metaoperators │ │ │ │ │ ├── 00-grafana │ │ │ │ │ │ ├── grafana.yaml │ │ │ │ │ │ └── k8s-api-dashboard.yaml │ │ │ │ │ └── README.md │ │ │ │ └── 05-kustomize │ │ │ │ │ ├── README.md │ │ │ │ │ └── argocd │ │ │ │ │ ├── bases │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── ingress │ │ │ │ │ ├── ingress.yaml │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ └── service │ │ │ │ │ └── kustomization.yaml │ │ │ └── 04.9-deployment-strategies │ │ │ │ ├── .gitignore │ │ │ │ ├── 00-monitoring │ │ │ │ ├── deployments-dashboard.yaml │ │ │ │ └── grafana.yaml │ │ │ │ ├── 01-recreate │ │ │ │ ├── README.md │ │ │ │ ├── app-v1.yaml │ │ │ │ ├── app-v2.yaml │ │ │ │ └── grafana-recreate.png │ │ │ │ ├── 02-ramped │ │ │ │ ├── README.md │ │ │ │ ├── app-v1.yaml │ │ │ │ ├── app-v2.yaml │ │ │ │ └── grafana-ramped.png │ │ │ │ ├── 03-blue-green │ │ │ │ ├── README.md │ │ │ │ ├── grafana-blue-green.png │ │ │ │ ├── multiple-services │ │ │ │ │ ├── README.md │ │ │ │ │ ├── app-a-v1.yaml │ │ │ │ │ ├── app-a-v2.yaml │ │ │ │ │ ├── app-b-v1.yaml │ │ │ │ │ ├── app-b-v2.yaml │ │ │ │ │ ├── ingress-v1.yaml │ │ │ │ │ └── ingress-v2.yaml │ │ │ │ └── single-service │ │ │ │ │ ├── README.md │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ ├── service-internal-v2.yaml │ │ │ │ │ ├── service-v1.yaml │ │ │ │ │ └── service-v2.yaml │ │ │ │ ├── 04-canary │ │ │ │ ├── README.md │ │ │ │ ├── grafana-canary.png │ │ │ │ ├── istio │ │ │ │ │ ├── README.md │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ ├── hpa.yaml │ │ │ │ │ └── istio.yaml │ │ │ │ ├── native │ │ │ │ │ ├── README.md │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ └── app-v2.yaml │ │ │ │ └── nginx-ingress │ │ │ │ │ ├── README.md │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ ├── ingress-v1.yaml │ │ │ │ │ ├── ingress-v2-canary.yaml │ │ │ │ │ └── ingress-v2.yaml │ │ │ │ ├── 05-ab-testing │ │ │ │ ├── gke │ │ │ │ │ ├── README.md │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ ├── ingress-ab.yaml │ │ │ │ │ ├── ingress-v1.yaml │ │ │ │ │ └── ingress-v2.yaml │ │ │ │ ├── grafana-ab-testing.png │ │ │ │ └── istio │ │ │ │ │ ├── README.md │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ ├── gateway.yaml │ │ │ │ │ ├── virtualservice-match.yaml │ │ │ │ │ ├── virtualservice-weight.yaml │ │ │ │ │ └── virtualservice.yaml │ │ │ │ ├── 06-shadow │ │ │ │ ├── README.md │ │ │ │ ├── app-v1.yaml │ │ │ │ ├── app-v2.yaml │ │ │ │ ├── gateway.yaml │ │ │ │ ├── grafana-shadow.png │ │ │ │ ├── virtualservice-mirror.yaml │ │ │ │ └── virtualservice.yaml │ │ │ │ ├── README.md │ │ │ │ ├── app │ │ │ │ ├── .dockerignore │ │ │ │ ├── Dockerfile │ │ │ │ ├── Makefile │ │ │ │ ├── README.md │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ └── main.go │ │ │ │ └── decision-diagram.png │ │ ├── 05-Providers │ │ │ ├── README.md │ │ │ ├── images │ │ │ │ ├── aks.png │ │ │ │ ├── demo.png │ │ │ │ ├── eks.png │ │ │ │ ├── gke.png │ │ │ │ └── virtual-kubelet.svg │ │ │ ├── kubernetes-clouds.slide │ │ │ └── labs │ │ │ │ ├── 01-providers │ │ │ │ ├── aws │ │ │ │ │ ├── README.md │ │ │ │ │ └── eks │ │ │ │ │ │ ├── cloudformation │ │ │ │ │ │ └── eks-nodegroup-cf-stack.yaml │ │ │ │ │ │ ├── iam │ │ │ │ │ │ └── AmazonEKSServiceRole.json │ │ │ │ │ │ ├── manifests │ │ │ │ │ │ ├── eks-admin-binding-role.yaml │ │ │ │ │ │ ├── eks-admin-service-account.yaml │ │ │ │ │ │ ├── eks-kubeconfig.yaml │ │ │ │ │ │ ├── k8s-aws-auth-cm.yaml │ │ │ │ │ │ └── manifests │ │ │ │ │ │ │ ├── eks-admin-binding-role.yaml │ │ │ │ │ │ │ ├── eks-admin-service-account.yaml │ │ │ │ │ │ │ ├── eks-kubeconfig.yaml │ │ │ │ │ │ │ └── k8s-aws-auth-cm.yaml │ │ │ │ │ │ └── route53 │ │ │ │ │ │ └── CustomRoute53RecordSet.json │ │ │ │ ├── azure │ │ │ │ │ └── README.md │ │ │ │ └── gcp │ │ │ │ │ └── README.md │ │ │ │ ├── 02-guestbook │ │ │ │ ├── README.md │ │ │ │ ├── app │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── Dockerfile │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── main.go │ │ │ │ │ └── public │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ ├── script.js │ │ │ │ │ │ ├── style.css │ │ │ │ │ │ └── upc.png │ │ │ │ ├── guestbook-page.png │ │ │ │ └── k8s │ │ │ │ │ ├── guestbook-deployment.yml │ │ │ │ │ ├── guestbook-service.yml │ │ │ │ │ ├── redis-master-deployemt.yml │ │ │ │ │ ├── redis-master-service.yml │ │ │ │ │ └── redis-slave.yml │ │ │ │ ├── 03-deployment-strategies │ │ │ │ ├── .gitignore │ │ │ │ ├── 00-grafana │ │ │ │ │ ├── deployments-dashboard.yaml │ │ │ │ │ └── grafana.yaml │ │ │ │ ├── 01-recreate │ │ │ │ │ ├── README.md │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ └── grafana-recreate.png │ │ │ │ ├── 02-ramped │ │ │ │ │ ├── README.md │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ └── grafana-ramped.png │ │ │ │ ├── 03-blue-green │ │ │ │ │ ├── README.md │ │ │ │ │ ├── grafana-blue-green.png │ │ │ │ │ ├── multiple-services │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── app-a-v1.yaml │ │ │ │ │ │ ├── app-a-v2.yaml │ │ │ │ │ │ ├── app-b-v1.yaml │ │ │ │ │ │ ├── app-b-v2.yaml │ │ │ │ │ │ ├── ingress-v1.yaml │ │ │ │ │ │ └── ingress-v2.yaml │ │ │ │ │ └── single-service │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ │ └── svc-v2.yaml │ │ │ │ ├── 04-canary │ │ │ │ │ ├── README.md │ │ │ │ │ ├── grafana-canary.png │ │ │ │ │ ├── istio │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ │ ├── hpa.yaml │ │ │ │ │ │ └── istio.yaml │ │ │ │ │ ├── native │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ │ └── app-v2.yaml │ │ │ │ │ └── nginx-ingress │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ │ ├── ingress-v1.yaml │ │ │ │ │ │ ├── ingress-v2-canary.yaml │ │ │ │ │ │ └── ingress-v2.yaml │ │ │ │ ├── 05-ab-testing │ │ │ │ │ ├── gke │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ │ ├── ingress-ab.yaml │ │ │ │ │ │ ├── ingress-v1.yaml │ │ │ │ │ │ └── ingress-v2.yaml │ │ │ │ │ ├── grafana-ab-testing.png │ │ │ │ │ └── istio │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ │ ├── gateway.yaml │ │ │ │ │ │ ├── virtualservice-match.yaml │ │ │ │ │ │ ├── virtualservice-weight.yaml │ │ │ │ │ │ └── virtualservice.yaml │ │ │ │ ├── 06-shadow │ │ │ │ │ ├── README.md │ │ │ │ │ ├── app-v1.yaml │ │ │ │ │ ├── app-v2.yaml │ │ │ │ │ ├── gateway.yaml │ │ │ │ │ ├── grafana-shadow.png │ │ │ │ │ ├── virtualservice-mirror.yaml │ │ │ │ │ └── virtualservice.yaml │ │ │ │ ├── README.md │ │ │ │ ├── app │ │ │ │ │ ├── .dockerignore │ │ │ │ │ ├── Dockerfile │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── README.md │ │ │ │ │ ├── go.mod │ │ │ │ │ ├── go.sum │ │ │ │ │ └── main.go │ │ │ │ └── decision-diagram.png │ │ │ │ ├── 04-statefulset │ │ │ │ ├── README.md │ │ │ │ ├── mysql-credentials-secret.yaml │ │ │ │ ├── mysql-sts.yaml │ │ │ │ └── wordpress-deployment.yaml │ │ │ │ ├── 05-daemonset │ │ │ │ ├── README.md │ │ │ │ ├── hostname-ds.yaml │ │ │ │ └── hostname-dwapi-ds.yaml │ │ │ │ ├── 06-jobs │ │ │ │ ├── README.md │ │ │ │ ├── hello-5-generated-job.yaml │ │ │ │ ├── hello-5-job.yaml │ │ │ │ └── hello-cronjob.yaml │ │ │ │ ├── 07-affinity-and-antiaffinity │ │ │ │ ├── README.md │ │ │ │ ├── hostname-affinity-deployment.yaml │ │ │ │ ├── hostname-antiaffinity-deployment.yaml │ │ │ │ ├── hostname-node-selector-deployment.yaml │ │ │ │ └── hostname-toleration-deployment.yaml │ │ │ │ └── README.md │ │ ├── 06-from-scratch │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── aws-ec2-instance.tf │ │ │ ├── guestbook │ │ │ │ ├── app-v4 │ │ │ │ │ ├── .gitignore │ │ │ │ │ ├── Dockerfile │ │ │ │ │ ├── Makefile │ │ │ │ │ ├── guestbook-deployment.yml │ │ │ │ │ ├── main.go │ │ │ │ │ └── public │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ ├── script.js │ │ │ │ │ │ ├── style.css │ │ │ │ │ │ └── upc.png │ │ │ │ ├── guestbook-deployment.yml │ │ │ │ ├── guestbook-service.yml │ │ │ │ ├── redis-master-deployemt.yml │ │ │ │ ├── redis-master-service.yml │ │ │ │ └── redis-slave.yml │ │ │ ├── hello-manifests │ │ │ │ ├── hello-cm.json │ │ │ │ ├── hello-dep-fixed.yml │ │ │ │ ├── hello-dep.json │ │ │ │ ├── hello-dep.yml │ │ │ │ └── hello-svc.yml │ │ │ ├── kubectl-cfg.yml │ │ │ └── my-app │ │ │ │ ├── deployment-v1.yaml │ │ │ │ ├── deployment-v2.yaml │ │ │ │ └── service.yaml │ │ └── 09-last │ │ │ ├── 00-ManagedCluser-GCP │ │ │ ├── README.md │ │ │ └── app │ │ │ │ ├── app-v1 │ │ │ │ ├── Dockerfile │ │ │ │ ├── Makefile │ │ │ │ └── app.go │ │ │ │ └── app-v2 │ │ │ │ ├── Dockerfile │ │ │ │ ├── Makefile │ │ │ │ └── app.go │ │ │ ├── 01-kops │ │ │ └── README.md │ │ │ ├── 02-rbac │ │ │ ├── README.md │ │ │ ├── pod.yaml │ │ │ ├── role.yaml │ │ │ ├── rolebinding.yaml │ │ │ └── serviceaccount.yaml │ │ │ └── 04-eks+fargate │ │ │ ├── AWSLoadBalancerController │ │ │ └── iam_policy.json │ │ │ ├── README.md │ │ │ └── guestbook-ingress.yaml │ └── slides │ │ └── README.md └── terraform │ ├── aws-academy-ec2-instance │ ├── .gitignore │ ├── README.md │ ├── aws-ec2-instance.tf │ └── lab.sh │ ├── aws-academy-ec2-k8s-instance │ ├── .gitignore │ ├── README.md │ └── aws-ec2-instance.tf │ ├── aws-academy-eks-managed-cluster │ ├── .gitignore │ ├── README.md │ ├── main.tf │ └── modules │ │ └── vpc │ │ ├── main.tf │ │ ├── outputs.tf │ │ └── variables.tf │ ├── ec2-instance │ ├── .gitignore │ └── aws-ec2-instance.tf │ ├── ec2-spot-instance │ ├── .gitignore │ └── aws-ec2-instance.tf │ └── modules │ └── aws │ ├── ec2 │ ├── ec2-academy-instance │ │ ├── main.tf │ │ ├── outputs.tf │ │ └── variables.tf │ ├── ec2-academy-k8s-instance │ │ ├── main.tf │ │ ├── outputs.tf │ │ ├── user_data.sh │ │ └── variables.tf │ ├── instance │ │ ├── main.tf │ │ ├── outputs.tf │ │ └── variables.tf │ └── spot-instance │ │ ├── main.tf │ │ ├── outputs.tf │ │ └── variables.tf │ └── vpc │ └── vpc │ ├── main.tf │ ├── outputs.tf │ └── variables.tf ├── k8s-from-scratch ├── .gitignore ├── NOTES.md ├── README.md ├── aws-ec2-instance.tf ├── greetings-crd │ ├── bye-greet.yml │ ├── greetings-crd.yml │ ├── greetings-operator-manifests │ │ ├── greetings-operator-deployment.yaml │ │ ├── greetings-operator-role.yaml │ │ ├── greetings-operator-roleBinding.yaml │ │ └── greetings-operator-serviceAccount.yaml │ ├── greetings-operator-src │ │ ├── .travis.yml │ │ ├── build │ │ │ ├── Dockerfile │ │ │ └── test-framework │ │ │ │ ├── Dockerfile │ │ │ │ └── ansible-test.sh │ │ ├── deploy │ │ │ ├── crds │ │ │ │ ├── k8s_v1_greeting_cr.yaml │ │ │ │ └── k8s_v1_greeting_crd.yaml │ │ │ ├── operator.yaml │ │ │ ├── role.yaml │ │ │ ├── role_binding.yaml │ │ │ └── service_account.yaml │ │ ├── molecule │ │ │ ├── default │ │ │ │ ├── asserts.yml │ │ │ │ ├── molecule.yml │ │ │ │ ├── playbook.yml │ │ │ │ └── prepare.yml │ │ │ ├── test-cluster │ │ │ │ ├── molecule.yml │ │ │ │ └── playbook.yml │ │ │ └── test-local │ │ │ │ ├── molecule.yml │ │ │ │ ├── playbook.yml │ │ │ │ └── prepare.yml │ │ ├── roles │ │ │ └── greeting │ │ │ │ ├── README.md │ │ │ │ ├── defaults │ │ │ │ └── main.yml │ │ │ │ ├── handlers │ │ │ │ └── main.yml │ │ │ │ ├── meta │ │ │ │ └── main.yml │ │ │ │ ├── tasks │ │ │ │ └── main.yml │ │ │ │ └── vars │ │ │ │ └── main.yml │ │ └── watches.yaml │ └── hello-greet.yml ├── hello-manifests │ ├── hello-cm.json │ ├── hello-dep-fixed.yml │ ├── hello-dep.json │ ├── hello-dep.yml │ └── hello-svc.yml ├── kubectl-cfg.yml └── terraform │ ├── .gitignore │ ├── modules │ └── aws │ │ ├── ec2 │ │ ├── instance │ │ │ ├── main.tf │ │ │ ├── outputs.tf │ │ │ └── variables.tf │ │ └── spot-instance │ │ │ ├── main.tf │ │ │ ├── outputs.tf │ │ │ └── variables.tf │ │ └── vpc │ │ └── vpc │ │ ├── main.tf │ │ ├── outputs.tf │ │ └── variables.tf │ └── resources │ ├── aws-ec2 │ ├── main.tf │ ├── outputs.tf │ └── provider.tf │ └── aws-network │ ├── main.tf │ ├── outputs.tf │ └── provider.tf ├── kubecon └── kubecap2019 │ └── yamls │ ├── Cluster-MachineDeployment.yaml │ ├── kind-stable-1-3.yaml │ ├── kind │ ├── 201_simple-rs-5.yaml │ ├── hello-sh.yaml │ └── kind-stable-1-3.yaml │ ├── smi-traffic-access-control.yaml │ ├── smi-traffic-metrics.yaml │ ├── smi-traffic-spec-http.yaml │ ├── smi-traffic-split.yaml │ └── travis.yaml ├── providers ├── README.md ├── aws │ ├── README.md │ └── eks │ │ ├── cloudformation │ │ └── eks-nodegroup-cf-stack.yaml │ │ ├── iam │ │ └── AmazonEKSServiceRole.json │ │ ├── manifests │ │ ├── eks-admin-binding-role.yaml │ │ ├── eks-admin-service-account.yaml │ │ ├── eks-kubeconfig.yaml │ │ ├── k8s-aws-auth-cm.yaml │ │ └── manifests │ │ │ ├── eks-admin-binding-role.yaml │ │ │ ├── eks-admin-service-account.yaml │ │ │ ├── eks-kubeconfig.yaml │ │ │ └── k8s-aws-auth-cm.yaml │ │ └── route53 │ │ └── CustomRoute53RecordSet.json ├── azure │ └── README.md ├── do │ ├── digital-ocean.slide │ ├── images │ │ ├── README.md │ │ ├── do-block-storage.svg │ │ ├── do-community.png │ │ ├── do-credit.gif │ │ ├── do-developers.png │ │ ├── do-domains.svg │ │ ├── do-droplets-backups.svg │ │ ├── do-droplets-firewalls.svg │ │ ├── do-droplets-monitoring.svg │ │ ├── do-droplets-sizes.png │ │ ├── do-droplets-snapshots.svg │ │ ├── do-droplets.svg │ │ ├── do-floating-ip-bg.svg │ │ ├── do-floating-ip.svg │ │ ├── do-images.svg │ │ ├── do-load-balancers-bg.svg │ │ ├── do-load-balancers.svg │ │ ├── do-logo-sammy.png │ │ ├── do-logo.png │ │ ├── do-main.png │ │ ├── do-managed-databases.png │ │ ├── do-managed-kubernetes.png │ │ ├── do-marketplace.png │ │ ├── do-private-networks.png │ │ ├── do-sammy-404.gif │ │ ├── do-sammy-load.gif │ │ ├── do-sammy-space.png │ │ ├── do-spaces.svg │ │ └── do-write-for-donations.svg │ └── labs │ │ ├── README.md │ │ ├── do │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── json │ │ │ └── k8s-1.13-cluster.json │ │ └── tf │ │ │ └── k8s-1.13-cluster.tf │ │ └── k8s │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── default │ │ ├── kslides-deployment.yaml │ │ └── kslides-service-lb.yaml │ │ └── kube-system │ │ ├── admin-user.yaml │ │ ├── kubernetes-dashboard-ingressRoute.yaml │ │ └── kubernetes-dashboard.yaml └── gcp │ └── README.md ├── study-jams ├── README.md ├── cloud │ └── do │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── json │ │ └── cnbcn-k8s-study-jam-cluster.json │ │ └── tf │ │ └── cnbcn-k8s-study-jam-cluster.tf ├── docker │ ├── Makefile │ └── raelga │ │ └── toolbox │ │ └── Dockerfile └── k8s │ ├── .gitignore │ ├── Makefile │ ├── default │ ├── pods │ │ ├── basics │ │ │ ├── boombox.yaml │ │ │ ├── busybox-0.yaml │ │ │ ├── busybox-100.yaml │ │ │ ├── busybox-30.yaml │ │ │ ├── busybox-probes-readiness-ko.yml │ │ │ ├── busybox-probes-readiness-ok.yml │ │ │ ├── busybox-resources-0.yaml │ │ │ ├── busybox-resources-10.yaml │ │ │ ├── busybox-resources-limits.yaml │ │ │ ├── busybox-resources-requests-unschedulable.yaml │ │ │ ├── busybox-resources-requests.yaml │ │ │ ├── busybox-resources.yaml │ │ │ ├── hello-sh-updated.yaml │ │ │ ├── hello-sh.yaml │ │ │ ├── nginx-and-shell-network.yaml │ │ │ ├── nginx-and-shell-volume.yaml │ │ │ ├── nginx.yaml │ │ │ └── shell.yaml │ │ ├── init-containers │ │ │ ├── busybox-init-containers-dummy-svc.yaml │ │ │ └── busybox-init-containers.yml │ │ └── lifecycle │ │ │ ├── busybox-probes-readiness-ko.yml │ │ │ ├── busybox-probes-readiness-ok.yml │ │ │ ├── nginx-probes-liveness.yml │ │ │ └── nginx-probes-readiness.yml │ └── replicasets │ │ ├── 101_simple-rs.yaml │ │ ├── 201_simple-rs-5.yaml │ │ ├── 202_simple-rs-50.yaml │ │ ├── 203_simple-rs-pods.yaml │ │ ├── 301_simple-blue-pods.yaml │ │ ├── 302_simple-blue-rs.yaml │ │ ├── 303_simple-red-pods.yaml │ │ ├── 304_simple-rs-nocolor-update.yaml │ │ ├── 305_simple-nocolor-rs.yaml │ │ ├── 306_simple-orange-pods.yaml │ │ ├── 307_simple-orange-rs.yaml │ │ ├── 400_probes-rs-readiness.yaml │ │ ├── 401_probes-rs-readiness-ko.yaml │ │ ├── 402_probes-rs-liveness.yaml │ │ ├── 403_probes-rs-liveness-ko.yaml │ │ ├── 501_probes-images-rs.yaml │ │ ├── 502_probes-images-rs-update-image-ko.yaml │ │ ├── 503_probes-images-rs-6-update-image-ko.yaml │ │ ├── 504_probes-images-rs-9-update-image-ok.yaml │ │ ├── 505_probes-images-rs-6-update-image-ok.yaml │ │ ├── 506_probes-images-rs-update-selector.yaml │ │ ├── 507_probes-images-v2.0-rs.yaml │ │ ├── 508_probes-images-scale-down-both-rs.yaml │ │ ├── 509_probes-images-scale-up-both-rs.yaml │ │ └── README.md │ └── kube-system │ ├── admin-user.yaml │ └── kubernetes-dashboard.yaml └── traefik ├── README.md ├── images ├── README.md ├── traefik-1.0-architecture.png ├── traefik-2.0-architecture.png ├── traefik-2.0-configuration-discovery.png ├── traefik-2.0-entrypoints.png ├── traefik-2.0-features-cross-provider.png ├── traefik-2.0-features-syntax.png ├── traefik-2.0-features-tcp.png ├── traefik-2.0-features-tls-termination.png ├── traefik-2.0-middleware-addprefix.png ├── traefik-2.0-middleware-errorpage.png ├── traefik-2.0-middleware-headers.png ├── traefik-2.0-middleware-ratelimit.png ├── traefik-2.0-middleware.png ├── traefik-2.0-routers.png ├── traefik-2.0-services.png ├── traefik-2.0.png ├── traefik-concepts-auto-discovery.png ├── traefik-concepts-edge-router.png ├── traefik-concepts-webui.png ├── traefik-examples-docker.png ├── traefik-examples-kubernetes.png ├── traefik-features.png ├── traefik-logo.svg └── traefik-overview.png ├── labs ├── README.md ├── docker │ ├── Makefile │ ├── host │ │ ├── bootstrap.sh │ │ ├── instance.jinja │ │ ├── instance.jinja.schema │ │ └── traefik-docker-host.yaml │ ├── tcp-mongo │ │ ├── 01-mongo │ │ │ ├── README.md │ │ │ └── docker-compose.yml │ │ ├── 02-tls-mongo │ │ │ ├── README.md │ │ │ ├── certs │ │ │ │ ├── cert.pem │ │ │ │ ├── key.pem │ │ │ │ └── mongo.pem │ │ │ ├── docker-compose.yml │ │ │ └── tls-certs.toml │ │ ├── 03-sni-routing-mongo │ │ │ ├── README.md │ │ │ ├── certs │ │ │ │ ├── cert.pem │ │ │ │ ├── key.pem │ │ │ │ └── mongo.pem │ │ │ ├── docker-compose.yml │ │ │ └── tls-certs.toml │ │ ├── 04-tcp-and-http-routing-mongo │ │ │ ├── README.md │ │ │ ├── certs │ │ │ │ ├── cert.pem │ │ │ │ ├── key.pem │ │ │ │ └── mongo.pem │ │ │ ├── docker-compose.yml │ │ │ └── tls-certs.toml │ │ └── root-certs │ │ │ ├── generate-certificates.sh │ │ │ ├── minica-key.pem │ │ │ └── minica.pem │ ├── traefik-v1.7 │ │ ├── Dockerfile │ │ └── context │ │ │ └── etc │ │ │ └── traefik │ │ │ ├── file.toml │ │ │ └── traefik.toml │ └── traefik-v2.0 │ │ ├── Dockerfile │ │ └── context │ │ └── etc │ │ └── traefik │ │ ├── file.toml │ │ └── traefik.toml └── k8s │ ├── Makefile │ ├── default │ ├── cats-deployment.yaml │ ├── cats-service-lb-with-typo.yaml │ ├── cats-service-lb.yaml │ ├── cats-services.yaml │ ├── cats-traefik-v1.0-catnary-ingress.yaml │ ├── cats-traefik-v1.0-http-ingress.yaml │ ├── cats-traefik-v2.0-http-ingressRoute.yaml │ ├── cats-traefik-v2.0-https-ingressRoute.yaml │ ├── header-routing.yml │ ├── htpasswd-secret │ ├── ttyd-deployment.yaml │ ├── whoami-deployment.yaml │ ├── whoami-ingress-annotations.yaml │ ├── whoami-ingress.yaml │ ├── whoami-ingressRoute.yaml │ ├── whoami-service-lb.yaml │ └── whoami-service.yaml │ └── traefik │ ├── traefik-chell-rbac.yaml │ ├── traefik-chell-sa.yaml │ ├── traefik-ns.yaml │ ├── traefik-v1.0-ds.yaml │ ├── traefik-v1.0-ingress.yaml │ ├── traefik-v1.0-rbac.yaml │ ├── traefik-v1.0-service-lb.yaml │ ├── traefik-v1.0-service.yaml │ ├── traefik-v2.0-authentication-middleware.yaml │ ├── traefik-v2.0-customResourceDefinition.yaml │ ├── traefik-v2.0-deployment-letsEncrypt.yaml │ ├── traefik-v2.0-deployment.yaml │ ├── traefik-v2.0-headers-middleware.yaml │ ├── traefik-v2.0-nocache-middleware.yaml │ ├── traefik-v2.0-rbac.yaml │ ├── traefik-v2.0-service-lb.yaml │ └── traefik-v2.0-service.yaml ├── traefik-live.slide └── traefik.slide /.dockerignore: -------------------------------------------------------------------------------- 1 | */labs* 2 | */*/labs* 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ws 2 | -------------------------------------------------------------------------------- /101/README.md: -------------------------------------------------------------------------------- 1 | # Kubernetes 101 2 | 3 | The main subject of this talk is to have an overview on the microservices architectures. Then, starts an introduction to the kubernetes architecture, core services and objects: pods, controllers, deployments and sets. 4 | 5 | ## Introduction to Kubernetes Architecture and Deployments Slides 6 | 7 | 8 | Live slides are available at: 9 | 10 | https://talks.godoc.org/github.com/raelga/kubernetes-talks/101/kubernetes-101.slide 11 | 12 | Plain text slides in [kubernetes-101.slide](kubernetes-101.slide). 13 | 14 | 15 | -------------------------------------------------------------------------------- /101/images/borg-cluster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/borg-cluster.png -------------------------------------------------------------------------------- /101/images/borg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/borg.jpg -------------------------------------------------------------------------------- /101/images/docker-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/docker-logo.png -------------------------------------------------------------------------------- /101/images/docker-package-software.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/docker-package-software.png -------------------------------------------------------------------------------- /101/images/kubernetes-cloud-cluster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/kubernetes-cloud-cluster.png -------------------------------------------------------------------------------- /101/images/kubernetes-cluster.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/kubernetes-cluster.png -------------------------------------------------------------------------------- /101/images/kubernetes-comic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/kubernetes-comic.png -------------------------------------------------------------------------------- /101/images/kubernetes-greek-etymology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/kubernetes-greek-etymology.png -------------------------------------------------------------------------------- /101/images/kubernetes-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/kubernetes-logo.png -------------------------------------------------------------------------------- /101/images/microservices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/microservices.png -------------------------------------------------------------------------------- /101/images/obligatory-cointainer-boat-photo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/obligatory-cointainer-boat-photo.png -------------------------------------------------------------------------------- /101/images/pods-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/pods-network.png -------------------------------------------------------------------------------- /101/images/pods-storage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/pods-storage.png -------------------------------------------------------------------------------- /101/images/servers-pets-vs-cattle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/servers-pets-vs-cattle.jpg -------------------------------------------------------------------------------- /101/images/servers-to-serverless.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/101/images/servers-to-serverless.png -------------------------------------------------------------------------------- /101/labs/app/app-v1/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.8.3 as builder 2 | WORKDIR /go/src/app 3 | COPY app.go . 4 | RUN CGO_ENABLED=0 GOOS=linux go build -a -o app . 5 | 6 | FROM alpine:latest 7 | RUN apk --no-cache add ca-certificates 8 | WORKDIR /root/ 9 | COPY --from=builder /go/src/app/app . 10 | CMD ["./app"] 11 | EXPOSE 9999 -------------------------------------------------------------------------------- /101/labs/app/app-v1/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker build . -t hello-world:v1 3 | 4 | run: 5 | docker run -p 9999:9999 -d hello-world:v1 6 | 7 | stop: 8 | docker stop $(docker ps -a --filter ancestor=hello-world:v1 -q) -------------------------------------------------------------------------------- /101/labs/app/app-v1/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net/http" 7 | ) 8 | 9 | // HelloWorld - Simple Hello World response 10 | func HelloWorld(w http.ResponseWriter, r *http.Request) { 11 | log.Print(r) 12 | fmt.Fprintf(w, "Hello World") 13 | } 14 | 15 | func main() { 16 | http.HandleFunc("/", HelloWorld) 17 | 18 | log.Println("Listeing at :9999...") 19 | err := http.ListenAndServe(":9999", nil) 20 | 21 | if err != nil { 22 | log.Fatal("Server ended, reason: ", err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /101/labs/app/app-v2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.8.3 as builder 2 | WORKDIR /go/src/app 3 | COPY app.go . 4 | RUN CGO_ENABLED=0 GOOS=linux go build -a -o app . 5 | 6 | FROM alpine:latest 7 | RUN apk --no-cache add ca-certificates 8 | WORKDIR /root/ 9 | COPY --from=builder /go/src/app/app . 10 | CMD ["./app"] 11 | EXPOSE 9999 -------------------------------------------------------------------------------- /101/labs/app/app-v2/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker build . -t hello-world:v2 3 | 4 | run: 5 | docker run -p 9999:9999 -d hello-world:v2 6 | 7 | stop: 8 | docker stop $(docker ps -a --filter ancestor=hello-world:v2 -q -------------------------------------------------------------------------------- /101/labs/app/app-v2/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net/http" 7 | "os" 8 | ) 9 | 10 | // HelloWorld - Simple Hello World response 11 | func HelloWorld(w http.ResponseWriter, r *http.Request) { 12 | log.Print(r) 13 | hostname, _ := os.Hostname() 14 | fmt.Fprintf(w, "Hello World from %s", hostname) 15 | } 16 | 17 | func main() { 18 | http.HandleFunc("/", HelloWorld) 19 | 20 | log.Println("Listeing at :9999...") 21 | err := http.ListenAndServe(":9999", nil) 22 | 23 | if err != nil { 24 | log.Fatal("Server ended, reason: ", err) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /101/yml/deployment-resources.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: frontend 5 | spec: 6 | containers: 7 | - name: db 8 | image: mysql 9 | resources: 10 | requests: 11 | memory: "64Mi" 12 | cpu: "250m" 13 | limits: 14 | memory: "128Mi" -------------------------------------------------------------------------------- /101/yml/pod-health-cmd-readiness.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | labels: 5 | test: readiness 6 | name: readiness-cmd 7 | spec: 8 | containers: 9 | - name: readiness 10 | image: k8s.gcr.io/busybox 11 | args: 12 | - /bin/sh 13 | - -c 14 | - sleep 30; touch /tmp/healthy; sleep 10; rm -rf /tmp/healthy; 15 | readinessProbe: 16 | exec: 17 | command: 18 | - cat 19 | - /tmp/healthy 20 | initialDelaySeconds: 5 21 | periodSeconds: 5 -------------------------------------------------------------------------------- /101/yml/pod-health-http-liveness.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: liveness-http 5 | spec: 6 | containers: 7 | - name: liveness 8 | image: k8s.gcr.io/liveness 9 | args: [ '/server' ] 10 | livenessProbe: 11 | httpGet: 12 | path: /healthz 13 | port: 8080 14 | periodSeconds: 3 -------------------------------------------------------------------------------- /101/yml/pod-health-tcp-both.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: goproxy 5 | labels: 6 | app: goproxy 7 | spec: 8 | containers: 9 | - name: goproxy 10 | image: k8s.gcr.io/goproxy:0.1 11 | ports: 12 | - containerPort: 8080 13 | readinessProbe: 14 | tcpSocket: 15 | port: 8080 16 | initialDelaySeconds: 5 17 | periodSeconds: 10 18 | livenessProbe: 19 | tcpSocket: 20 | port: 8080 21 | initialDelaySeconds: 15 22 | periodSeconds: 20 -------------------------------------------------------------------------------- /101/yml/pod-multi.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | spec: 4 | volumes: 5 | - name: html 6 | emptyDir: {} 7 | containers: 8 | - name: webserver 9 | image: nginx 10 | volumeMounts: 11 | - name: html 12 | mountPath: /usr/share/nginx/html 13 | - name: content 14 | image: debian 15 | volumeMounts: 16 | - name: html 17 | mountPath: /html 18 | command: ["/bin/sh", "-c"] 19 | args: 20 | - while true; do 21 | date >> /html/index.html; sleep 1; 22 | done -------------------------------------------------------------------------------- /101/yml/pod-selector-equality.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: cuda-test 5 | spec: 6 | containers: 7 | - name: cuda-test 8 | image: "k8s.gcr.io/cuda-vector-add:v0.1" 9 | nodeSelector: 10 | accelerator: nvidia-tesla-p100 -------------------------------------------------------------------------------- /101/yml/pod-selector-set.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: dummy-test 5 | spec: 6 | containers: 7 | - name: dummy 8 | image: nginx 9 | affinity: 10 | nodeAffinity: 11 | preferredDuringSchedulingIgnoredDuringExecution: 12 | - weight: 1 13 | preference: 14 | matchExpressions: 15 | - { key: environment, operator: In, values: [pre, dev] } 16 | -------------------------------------------------------------------------------- /101/yml/pod-single.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: hello-web 5 | spec: 6 | containers: 7 | - name: hello 8 | image: nginx 9 | ports: 10 | - containerPort: 80 11 | -------------------------------------------------------------------------------- /101/yml/replicaset-deployment.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: hello-world-deployment 5 | labels: 6 | app: hello-app 7 | spec: 8 | replicas: 3 9 | selector: 10 | matchLabels: 11 | app: hello-app 12 | spec: 13 | containers: 14 | - name: hello-world 15 | image: hello 16 | -------------------------------------------------------------------------------- /101/yml/replicaset-hpa.yml: -------------------------------------------------------------------------------- 1 | apiVersion: autoscaling/v1 2 | kind: HorizontalPodAutoscaler 3 | metadata: 4 | name: frontend-scaler 5 | spec: 6 | scaleTargetRef: 7 | kind: ReplicaSet 8 | name: frontend 9 | minReplicas: 3 10 | maxReplicas: 10 11 | targetCPUUtilizationPercentage: 50 -------------------------------------------------------------------------------- /101/yml/replicaset-selector-set.yml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: helloworld 5 | spec: 6 | replicas: 3 7 | selector: 8 | matchLabels: 9 | tier: frontend 10 | matchExpressions: 11 | - {key: environmnt, operator: In, values: [pre, dev]} -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:alpine 2 | 3 | RUN apk --update add git openssh && \ 4 | rm -rf /var/lib/apt/lists/* && \ 5 | rm /var/cache/apk/* 6 | 7 | RUN go get golang.org/x/tools/cmd/present 8 | 9 | COPY 101/kubernetes-101.slide /slides/101/ 10 | COPY 101/images /slides/101/images 11 | COPY 101/yml /slides/101/yml 12 | 13 | COPY clouds/kubernetes-clouds.slide /slides/clouds/ 14 | COPY clouds/images /slides/clouds/images 15 | 16 | COPY traefik/traefik.slide /slides/traefik/ 17 | COPY traefik/images /slides/traefik/images 18 | 19 | COPY providers/do/digital-ocean.slide /slides/providers/do/ 20 | COPY providers/do/images /slides/providers/do/images 21 | 22 | EXPOSE 3999 23 | WORKDIR /slides 24 | 25 | CMD ["present", "-http=0.0.0.0:3999", "-play=false" ] 26 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | default: docker-build docker-present 2 | 3 | present: 4 | present 5 | 6 | docker-build: 7 | docker build -t kubernetes-slides . 8 | 9 | docker-live: 10 | docker run -it --rm -v "$(CURDIR)/:/slides" -p 3999:3999 kubernetes-slides 11 | 12 | docker-shell: 13 | docker run -it --rm -p 3999:3999 kubernetes-slides sh 14 | 15 | docker-present: 16 | docker run -it --rm -p 3999:3999 kubernetes-slides 17 | 18 | docker-push: 19 | docker tag kubernetes-slides:latest raelga/kslides:latest 20 | docker push raelga/kslides:latest 21 | -------------------------------------------------------------------------------- /clouds/images/aks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/clouds/images/aks.png -------------------------------------------------------------------------------- /clouds/images/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/clouds/images/demo.png -------------------------------------------------------------------------------- /clouds/images/eks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/clouds/images/eks.png -------------------------------------------------------------------------------- /clouds/images/gke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/clouds/images/gke.png -------------------------------------------------------------------------------- /clouds/labs/README.md: -------------------------------------------------------------------------------- 1 | # Kubernetes Clouds Lab 2 | 3 | ## Deploy a kubernetes cluster 4 | 5 | On each provider folder, you will found a step by step guide on how to deploy a kubernetes cluster and any extra file needed. 6 | 7 | - [Amazon Web services](aws/#deploy-kubernetes-in-aws) 8 | - [AWS managed Kubernetes with EKS](aws/#managed-kubernetes-with-eks) 9 | - [AWS managed Kubernetes with EKS using eksctl](aws/#amazon-web-services---eksctl-alpha) 10 | - [AWS non-managed on EC2 with Kops](aws/#amazon-web-services---kops) 11 | - [Google Cloud Platform](gcp/#deploy-kubernetes-in-google-cloud-platform) 12 | - [GCP managed Kubernetes with GKE](gcp#managed-kubernetes-with-google-kubernetes-engine-gke) 13 | - [Azure](azure/#deploy-kubernetes-in-microsoft-azure) 14 | - [Azure managed Kubernetes with AKS](azure/#managed-kubernetes-with-azure-kubernetes-service-aks) -------------------------------------------------------------------------------- /clouds/labs/aws/eks/iam/AmazonEKSServiceRole.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2012-10-17", 3 | "Statement": [ 4 | { 5 | "Effect": "Allow", 6 | "Principal": { 7 | "Service": "eks.amazonaws.com" 8 | }, 9 | "Action": "sts:AssumeRole" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /clouds/labs/aws/eks/manifests/eks-admin-binding-role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1beta1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: eks-admin 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: cluster-admin 9 | subjects: 10 | - kind: ServiceAccount 11 | name: eks-admin 12 | namespace: kube-system -------------------------------------------------------------------------------- /clouds/labs/aws/eks/manifests/eks-admin-service-account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: eks-admin 5 | namespace: kube-system -------------------------------------------------------------------------------- /clouds/labs/aws/eks/manifests/eks-kubeconfig.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | clusters: 3 | - cluster: 4 | server: 5 | certificate-authority-data: 6 | name: 7 | contexts: 8 | - context: 9 | cluster: 10 | user: k8s 11 | name: 12 | kind: Config 13 | preferences: {} 14 | users: 15 | - name: k8s 16 | user: 17 | exec: 18 | apiVersion: client.authentication.k8s.io/v1alpha1 19 | command: heptio-authenticator-aws 20 | args: 21 | - "token" 22 | - "-i" 23 | - "" -------------------------------------------------------------------------------- /clouds/labs/aws/eks/manifests/k8s-aws-auth-cm.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: aws-auth 5 | namespace: kube-system 6 | data: 7 | mapRoles: | 8 | - rolearn: 9 | username: system:node:{{EC2PrivateDNSName}} 10 | groups: 11 | - system:bootstrappers 12 | - system:nodes 13 | -------------------------------------------------------------------------------- /clouds/labs/aws/eks/manifests/manifests/eks-admin-binding-role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1beta1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: eks-admin 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: cluster-admin 9 | subjects: 10 | - kind: ServiceAccount 11 | name: eks-admin 12 | namespace: kube-system -------------------------------------------------------------------------------- /clouds/labs/aws/eks/manifests/manifests/eks-admin-service-account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: eks-admin 5 | namespace: kube-system -------------------------------------------------------------------------------- /clouds/labs/aws/eks/manifests/manifests/eks-kubeconfig.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | clusters: 3 | - cluster: 4 | server: 5 | certificate-authority-data: 6 | name: 7 | contexts: 8 | - context: 9 | cluster: 10 | user: k8s 11 | name: .talks.aws.rael.io 12 | kind: Config 13 | preferences: {} 14 | users: 15 | - name: k8s 16 | user: 17 | exec: 18 | apiVersion: client.authentication.k8s.io/v1alpha1 19 | command: heptio-authenticator-aws 20 | args: 21 | - "token" 22 | - "-i" 23 | - "" 24 | env: 25 | - name: AWS_PROFILE 26 | value: "k8s-talks" -------------------------------------------------------------------------------- /clouds/labs/aws/eks/manifests/manifests/k8s-aws-auth-cm.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: aws-auth 5 | namespace: kube-system 6 | data: 7 | mapRoles: | 8 | - rolearn: 9 | username: system:node:{{EC2PrivateDNSName}} 10 | groups: 11 | - system:bootstrappers 12 | - system:nodes 13 | -------------------------------------------------------------------------------- /clouds/labs/aws/eks/route53/CustomRoute53RecordSet.json: -------------------------------------------------------------------------------- 1 | { 2 | "Comment": "Update record to reflect new cluster endpoint", 3 | "Changes": [ 4 | { 5 | "Action": "UPSERT", 6 | "ResourceRecordSet": { 7 | "Name": "api.eks.talks.aws.rael.io.", 8 | "Type": "CNAME", 9 | "TTL": 300, 10 | "ResourceRecords": [ 11 | { 12 | "Value": "" 13 | } 14 | ] 15 | } 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /clouds/labs/demo-app/README.md: -------------------------------------------------------------------------------- 1 | ## Guestbook Example 2 | 3 | This example shows how to build a simple multi-tier web application using Kubernetes and Docker. The application consists of a web front end, Redis master for storage, and replicated set of Redis slaves, all for which we will create Kubernetes replication controllers, pods, and services. 4 | 5 | ![Guestbook](guestbook-page.png) -------------------------------------------------------------------------------- /clouds/labs/demo-app/app/.gitignore: -------------------------------------------------------------------------------- 1 | guestbook_bin 2 | -------------------------------------------------------------------------------- /clouds/labs/demo-app/app/public/k8s-for-all.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/clouds/labs/demo-app/app/public/k8s-for-all.jpg -------------------------------------------------------------------------------- /clouds/labs/demo-app/guestbook-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/clouds/labs/demo-app/guestbook-page.png -------------------------------------------------------------------------------- /clouds/labs/demo-app/k8s/guestbook-deployment.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Deployment 3 | apiVersion: apps/v1beta2 4 | metadata: 5 | name: guestbook 6 | labels: 7 | app: guestbook 8 | spec: 9 | replicas: 3 10 | selector: 11 | matchLabels: 12 | app: guestbook 13 | template: 14 | metadata: 15 | labels: 16 | app: guestbook 17 | spec: 18 | containers: 19 | - name: guestbook 20 | image: raelga/guestbook:latest 21 | ports: 22 | - name: http-server 23 | containerPort: 3000 24 | -------------------------------------------------------------------------------- /clouds/labs/demo-app/k8s/guestbook-service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: guestbook 6 | labels: 7 | app: guestbook 8 | spec: 9 | ports: 10 | - port: 80 11 | targetPort: http-server 12 | selector: 13 | app: guestbook 14 | type: LoadBalancer -------------------------------------------------------------------------------- /clouds/labs/demo-app/k8s/redis-master-deployemt.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Deployment 3 | apiVersion: apps/v1beta2 4 | metadata: 5 | name: redis-master 6 | labels: 7 | app: redis 8 | role: master 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: redis 14 | role: master 15 | template: 16 | metadata: 17 | labels: 18 | app: redis 19 | role: master 20 | spec: 21 | containers: 22 | - name: redis-master 23 | image: redis:2.8.23 24 | ports: 25 | - name: redis-server 26 | containerPort: 6379 -------------------------------------------------------------------------------- /clouds/labs/demo-app/k8s/redis-master-service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: redis-master 6 | labels: 7 | app: redis 8 | role: master 9 | spec: 10 | ports: 11 | - port: 6379 12 | targetPort: redis-server 13 | selector: 14 | app: redis 15 | role: master -------------------------------------------------------------------------------- /course/README.md: -------------------------------------------------------------------------------- 1 | # Kubernetes Course 2 | 3 | Slides are available at https://go.rael.dev/k8s-course 4 | -------------------------------------------------------------------------------- /course/containers/README.md: -------------------------------------------------------------------------------- 1 | # Kubernetes Course 2 | 3 | ## Containers 4 | 5 | Slides are available at https://go.rael.dev/k8s-course 6 | 7 | ## Labs 8 | 9 | Labs will require a Linux server with CGroups tools, Docker and Docker Compose. 10 | 11 | In case you don't have access to a server, in the [terraform](../terraform) folder 12 | you can find a som terraform stacks to deploy an instance. 13 | 14 | - [AWS Academy EC2 Instance](../terraform/aws-academy-ec2-instance) if your are using an AWS 15 | academty account, as it has some restrictions and limitations. 16 | - [EC2 Instance](../terraform/ec2-instance) if your are using a regular AWS account with full 17 | privleges. 18 | - [EC2 Spot Instance](../terraform/ec2-spot-instance) if your are using a regular AWS account 19 | with full privleges and want to use cheaper spot instances. 20 | -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.1-hello-world/v1/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | CMD ["/bin/echo", "Hello World!"] 3 | -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.1-hello-world/v1/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker build . -t hello-world:v1 3 | 4 | run: 5 | docker run hello-world:v1 6 | 7 | stop: 8 | docker stop $(docker ps -a --filter ancestor=hello-world:v1 -q) -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.1-hello-world/v2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | 3 | RUN echo "Hello World from a file!" >/hello.txt 4 | 5 | CMD ["/bin/cat", "/hello.txt"] 6 | -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.1-hello-world/v2/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker build . -t hello-world:v2 3 | 4 | run: 5 | docker run hello-world:v2 6 | 7 | stop: 8 | docker stop $(docker ps -a --filter ancestor=hello-world:v2 -q) -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.1-hello-world/v3/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | 3 | RUN echo "Hello World from a file!" >/hello.txt 4 | 5 | RUN echo "Saving some info for later." >/later.txt 6 | 7 | CMD ["/bin/cat", "/hello.txt"] 8 | -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.1-hello-world/v3/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker build . -t hello-world:v3 3 | 4 | run: 5 | docker run hello-world:v3 6 | 7 | stop: 8 | docker stop $(docker ps -a --filter ancestor=hello-world:v3 -q) -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.2-hello-world-go/v1/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.8.3 as builder 2 | WORKDIR /go/src/app 3 | COPY app.go . 4 | RUN CGO_ENABLED=0 GOOS=linux go build -a -o app . 5 | 6 | FROM alpine:latest 7 | RUN apk --no-cache add ca-certificates 8 | WORKDIR /root/ 9 | COPY --from=builder /go/src/app/app . 10 | CMD ["./app"] 11 | EXPOSE 9999 -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.2-hello-world-go/v1/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker build . -t hello-world-go:v1 3 | 4 | run: 5 | docker run -p 9999:9999 -d hello-world-go:v1 6 | 7 | stop: 8 | docker stop $(docker ps -a --filter ancestor=hello-world-go:v1 -q) -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.2-hello-world-go/v1/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net/http" 7 | ) 8 | 9 | // HelloWorld - Simple Hello World response 10 | func HelloWorld(w http.ResponseWriter, r *http.Request) { 11 | log.Print(r) 12 | fmt.Fprintf(w, "Hello World") 13 | } 14 | 15 | func main() { 16 | http.HandleFunc("/", HelloWorld) 17 | 18 | log.Println("Listeing at :9999...") 19 | err := http.ListenAndServe(":9999", nil) 20 | 21 | if err != nil { 22 | log.Fatal("Server ended, reason: ", err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.2-hello-world-go/v2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.8.3 as builder 2 | WORKDIR /go/src/app 3 | COPY app.go . 4 | RUN CGO_ENABLED=0 GOOS=linux go build -a -o app . 5 | 6 | FROM alpine:latest 7 | RUN apk --no-cache add ca-certificates 8 | WORKDIR /root/ 9 | COPY --from=builder /go/src/app/app . 10 | CMD ["./app"] 11 | EXPOSE 9999 -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.2-hello-world-go/v2/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker build . -t hello-world-go:v2 3 | 4 | run: 5 | docker run -p 9999:9999 -d hello-world-go:v2 6 | 7 | stop: 8 | docker stop $(docker ps -a --filter ancestor=hello-world-go:v2 -q -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.2-hello-world-go/v2/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net/http" 7 | "os" 8 | ) 9 | 10 | // HelloWorld - Simple Hello World response 11 | func HelloWorld(w http.ResponseWriter, r *http.Request) { 12 | log.Print(r) 13 | hostname, _ := os.Hostname() 14 | fmt.Fprintf(w, "Hello World from %s", hostname) 15 | } 16 | 17 | func main() { 18 | http.HandleFunc("/", HelloWorld) 19 | 20 | log.Println("Listeing at :9999...") 21 | err := http.ListenAndServe(":9999", nil) 22 | 23 | if err != nil { 24 | log.Fatal("Server ended, reason: ", err) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.3-hello-world-nginx/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM nginx:mainline-alpine 2 | 3 | # We need to give all user groups write permission on folder /var/cache/nginx/ and file /var/run/nginx.pid. 4 | # So users with random uid will be able to run NGINX. 5 | RUN chmod -R a+w /var/cache/nginx/ \ 6 | && touch /var/run/nginx.pid \ 7 | && chmod a+w /var/run/nginx.pid \ 8 | && rm /etc/nginx/conf.d/* 9 | 10 | COPY hello.conf /etc/nginx/conf.d/ 11 | COPY index.html /usr/share/nginx/html/ 12 | EXPOSE 8080 13 | USER nginx -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.3-hello-world-nginx/Makefile: -------------------------------------------------------------------------------- 1 | VERSION=0.1 2 | REPOSITORY?=raelga/hello-world-nginx 3 | TAG=v$(VERSION) 4 | 5 | all: build push 6 | 7 | build: 8 | @echo "Building image:" 9 | docker build -t $(REPOSITORY):$(TAG) -f Dockerfile ctx 10 | 11 | push: 12 | @echo "Pushing image:" 13 | docker push $(REPOSITORY):$(TAG) 14 | 15 | run: 16 | @echo "Running container:" 17 | docker run --rm -p 8080:8080 $(REPOSITORY):$(TAG) 18 | 19 | bg: 20 | @echo "Running container in the background:" 21 | docker run --name hello --rm -d -p 8080:8080 $(REPOSITORY):$(TAG) -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/02.3-hello-world-nginx/ctx/hello.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 8080; 3 | listen [::]:8080; 4 | 5 | root /usr/share/nginx/html; 6 | try_files /index.html =404; 7 | 8 | expires -1; 9 | 10 | sub_filter_once off; 11 | sub_filter 'server_hostname' '$hostname'; 12 | sub_filter 'server_address' '$server_addr:$server_port'; 13 | sub_filter 'server_url' '$request_uri'; 14 | sub_filter 'server_date' '$time_local'; 15 | sub_filter 'request_id' '$request_id'; 16 | } -------------------------------------------------------------------------------- /course/containers/labs/02-Docker/Extra.md: -------------------------------------------------------------------------------- 1 | # Take a look to existing Dockerfiles available online 2 | 3 | https://github.com/3scale-ops/soyuz/blob/main/Dockerfile 4 | 5 | https://github.com/Shopify/docker/blob/master/Dockerfile 6 | 7 | https://github.com/docker-library/ 8 | -------------------------------------------------------------------------------- /course/containers/slides/README.md: -------------------------------------------------------------------------------- 1 | # Slides 2 | 3 | https://go.rael.dev/k8s-course 4 | -------------------------------------------------------------------------------- /course/kubernetes/README.md: -------------------------------------------------------------------------------- 1 | # Kubernetes Course 2 | 3 | ## Kubernetes 4 | 5 | Slides are available at https://go.rael.dev/k8s-course 6 | 7 | ## Labs 8 | 9 | Labs will require a Linux server with CGroups tools, Docker and Docker Compose. 10 | 11 | In case you don't have access to a server, in the [terraform](../terraform) folder 12 | you can find a som terraform stacks to deploy an instance. 13 | 14 | - [K8S AWS Academy EC2 Instance](../terraform/k8s-aws-academy-ec2-instance) if your are using an AWS 15 | academty account, as it has some restrictions and limitations. 16 | -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.1-Basics/busybox-0.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-0 6 | labels: 7 | app: busybox 8 | id: "0" 9 | spec: 10 | containers: 11 | - name: busybox 12 | image: busybox 13 | command: ['sh', '-c', 'sleep 321'] 14 | -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.1-Basics/hello-sh-updated.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: hello-sh 6 | labels: 7 | app: hello-sh 8 | spec: 9 | containers: 10 | - name: hello-sh 11 | image: busybox 12 | command: ['sh', '-c', 'echo Hello Kubernetes from $(hostname)! && sleep 3600'] 13 | -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.1-Basics/hello-sh.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: hello-sh 6 | labels: 7 | app: hello-sh 8 | tier: demo 9 | spec: 10 | containers: 11 | - name: hello-sh 12 | image: busybox 13 | command: ['sh', '-c', 'echo Hello Kubernetes from $(hostname)! && sleep 30'] 14 | -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.1-Basics/hello-web.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: hello-web 5 | spec: 6 | containers: 7 | - name: hello 8 | image: nginx 9 | ports: 10 | - containerPort: 80 11 | -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.1-Basics/pod-selector-equality.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: cuda-test 5 | spec: 6 | containers: 7 | - name: cuda-test 8 | image: "k8s.gcr.io/cuda-vector-add:v0.1" 9 | nodeSelector: 10 | accelerator: nvidia-tesla-p100 -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.1-Basics/pod-selector-set.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: dummy-test 5 | spec: 6 | containers: 7 | - name: dummy 8 | image: nginx 9 | affinity: 10 | nodeAffinity: 11 | preferredDuringSchedulingIgnoredDuringExecution: 12 | - weight: 1 13 | preference: 14 | matchExpressions: 15 | - { key: environment, operator: In, values: [pre, dev] } 16 | -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.1-Basics/shell.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: shell 6 | labels: 7 | app: shell 8 | spec: 9 | containers: 10 | - name: shell 11 | image: raelga/toolbox 12 | command: ['bash', '-c', 'sleep 3600'] -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.2-Resources/busybox-resources-0.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-resources-0 6 | labels: 7 | app: busybox 8 | resources: both 9 | id: "0" 10 | spec: 11 | containers: 12 | - name: busybox 13 | image: busybox 14 | command: ['sh', '-c', 'sleep 321'] 15 | resources: 16 | requests: 17 | cpu: "25m" 18 | memory: "512Mi" 19 | limits: 20 | cpu: "1" 21 | memory: "1024Mi" -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.2-Resources/busybox-resources-limits.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-resources-limits 6 | labels: 7 | app: busybox 8 | resources: limits 9 | spec: 10 | containers: 11 | - name: busybox 12 | image: busybox 13 | command: ['sh', '-c', 'sleep 321'] 14 | resources: 15 | limits: 16 | cpu: "100m" 17 | memory: "100Mi" -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.2-Resources/busybox-resources-requests-unschedulable.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-resources-requests-unschedulable 6 | labels: 7 | app: busybox 8 | resources: unschedulable 9 | spec: 10 | containers: 11 | - name: busybox 12 | image: busybox 13 | command: ['sh', '-c', 'sleep 321'] 14 | resources: 15 | requests: 16 | cpu: "4" 17 | memory: "1000Mi" -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.2-Resources/busybox-resources-requests.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-resources-requests-0 6 | labels: 7 | app: busybox 8 | resources: requests 9 | id: "0" 10 | spec: 11 | containers: 12 | - name: busybox 13 | image: busybox 14 | command: ['sh', '-c', 'sleep 321'] 15 | resources: 16 | requests: 17 | cpu: "25m" 18 | memory: "256Mi" 19 | limits: 20 | cpu: "1" 21 | memory: "512Mi" -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.2-Resources/busybox-resources.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-resources-both 6 | labels: 7 | app: busybox 8 | resources: both 9 | spec: 10 | containers: 11 | - name: busybox 12 | image: busybox 13 | command: ['sh', '-c', 'sleep 321'] 14 | resources: 15 | requests: 16 | cpu: "100m" 17 | memory: "100Mi" 18 | limits: 19 | cpu: "100m" 20 | memory: "100Mi" -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.3-Multi/nginx-and-shell-network.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: nginx-and-shell-network 6 | labels: 7 | app: nginx 8 | tier: frontend 9 | spec: 10 | containers: 11 | - name: nginx 12 | image: nginx:1.15.11-alpine 13 | ports: 14 | - containerPort: 80 15 | resources: 16 | requests: 17 | cpu: "100m" 18 | memory: "100Mi" 19 | limits: 20 | cpu: "100m" 21 | memory: "100Mi" 22 | - name: shell 23 | image: raelga/toolbox 24 | command: ['bash', '-c', 'sleep 3600'] 25 | resources: 26 | requests: 27 | cpu: "100m" 28 | memory: "100Mi" 29 | limits: 30 | cpu: "100m" 31 | memory: "100Mi" 32 | -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.3-Multi/pod-multi.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | spec: 4 | volumes: 5 | - name: html 6 | emptyDir: {} 7 | containers: 8 | - name: webserver 9 | image: nginx 10 | volumeMounts: 11 | - name: html 12 | mountPath: /usr/share/nginx/html 13 | - name: content 14 | image: debian 15 | volumeMounts: 16 | - name: html 17 | mountPath: /html 18 | command: ["/bin/sh", "-c"] 19 | args: 20 | - while true; do 21 | date >> /html/index.html; sleep 1; 22 | done -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.4-lifecycle/busybox-probes-readiness-ko.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: busybox-probes-readiness-ko 5 | spec: 6 | containers: 7 | - name: busybox 8 | image: busybox 9 | args: 10 | - /bin/sh 11 | - -c 12 | - echo 'Hi!'; sleep 20; echo 'Healthy!'; touch /tmp/healthy; sleep 10; rm -vrf /tmp/healthy; sleep 3600; 13 | readinessProbe: 14 | exec: 15 | command: 16 | - cat 17 | - /tmp/healthy 18 | initialDelaySeconds: 15 19 | periodSeconds: 1 -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.4-lifecycle/busybox-probes-readiness-ok.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: busybox-probes-readiness-ok 5 | spec: 6 | containers: 7 | - name: busybox 8 | image: busybox 9 | args: 10 | - /bin/sh 11 | - -c 12 | - echo 'Hi!'; sleep 10; echo 'Healthy!'; touch /tmp/healthy; sleep 10; sleep 3600; 13 | readinessProbe: 14 | exec: 15 | command: 16 | - cat 17 | - /tmp/healthy 18 | initialDelaySeconds: 1 19 | periodSeconds: 5 20 | -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.4-lifecycle/pod-health-cmd-readiness.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | labels: 5 | test: readiness 6 | name: readiness-cmd 7 | spec: 8 | containers: 9 | - name: readiness 10 | image: k8s.gcr.io/busybox 11 | args: 12 | - /bin/sh 13 | - -c 14 | - sleep 30; touch /tmp/healthy; sleep 10; rm -rf /tmp/healthy; sleep 3600; 15 | readinessProbe: 16 | exec: 17 | command: 18 | - cat 19 | - /tmp/healthy 20 | initialDelaySeconds: 5 21 | periodSeconds: 5 22 | -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.4-lifecycle/pod-health-http-liveness.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: liveness-http 5 | spec: 6 | containers: 7 | - name: liveness 8 | image: k8s.gcr.io/liveness 9 | args: [ '/server' ] 10 | livenessProbe: 11 | httpGet: 12 | path: /healthz 13 | port: 8080 14 | periodSeconds: 3 -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.4-lifecycle/pod-health-tcp-both.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: goproxy 5 | labels: 6 | app: goproxy 7 | spec: 8 | containers: 9 | - name: goproxy 10 | image: k8s.gcr.io/goproxy:0.1 11 | ports: 12 | - containerPort: 8080 13 | readinessProbe: 14 | tcpSocket: 15 | port: 8080 16 | initialDelaySeconds: 5 17 | periodSeconds: 10 18 | livenessProbe: 19 | tcpSocket: 20 | port: 8080 21 | initialDelaySeconds: 15 22 | periodSeconds: 20 -------------------------------------------------------------------------------- /course/kubernetes/labs/01-Pods/01.5-init-containers/busybox-init-containers-dummy-svc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: dummy-svc 6 | spec: 7 | ports: 8 | - protocol: TCP 9 | port: 80 10 | targetPort: 1234 -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/101_simple-rs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: simple 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | app: simple 10 | template: 11 | metadata: 12 | labels: 13 | app: simple 14 | spec: 15 | containers: 16 | - name: app 17 | image: raelga/cats:gatet -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/201_simple-rs-5.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: simple 5 | spec: 6 | replicas: 5 7 | selector: 8 | matchLabels: 9 | app: simple 10 | template: 11 | metadata: 12 | labels: 13 | app: simple 14 | spec: 15 | containers: 16 | - name: app 17 | image: raelga/cats:gatet 18 | resources: 19 | requests: 20 | cpu: "100m" 21 | memory: "50Mi" 22 | limits: 23 | cpu: "1" 24 | memory: "100Mi" -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/202_simple-rs-50.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: simple 5 | spec: 6 | replicas: 50 7 | selector: 8 | matchLabels: 9 | app: simple 10 | template: 11 | metadata: 12 | labels: 13 | app: simple 14 | spec: 15 | containers: 16 | - name: app 17 | image: raelga/cats:gatet 18 | resources: 19 | requests: 20 | cpu: "100m" 21 | memory: "50Mi" 22 | limits: 23 | cpu: "1" 24 | memory: "100Mi" -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/301_simple-blue-pods.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: simple-blue-pod-1 6 | labels: 7 | app: simple 8 | color: blue 9 | spec: 10 | containers: 11 | - name: app 12 | image: raelga/cats:liam 13 | --- 14 | apiVersion: v1 15 | kind: Pod 16 | metadata: 17 | name: simple-blue-pod-2 18 | labels: 19 | app: simple 20 | color: blue 21 | spec: 22 | containers: 23 | - name: app 24 | image: raelga/cats:liam 25 | --- 26 | apiVersion: v1 27 | kind: Pod 28 | metadata: 29 | name: simple-blue-pod-3 30 | labels: 31 | app: simple 32 | color: blue 33 | spec: 34 | containers: 35 | - name: app 36 | image: raelga/cats:liam -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/302_simple-blue-rs.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: ReplicaSet 4 | metadata: 5 | name: simple-blue 6 | spec: 7 | replicas: 5 8 | selector: 9 | matchLabels: 10 | app: simple 11 | color: blue 12 | template: 13 | metadata: 14 | labels: 15 | app: simple 16 | color: blue 17 | spec: 18 | containers: 19 | - name: app 20 | image: raelga/cats:liam 21 | -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/303_simple-red-pods.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: simple-red-pod-1 6 | labels: 7 | app: simple 8 | color: red 9 | spec: 10 | containers: 11 | - name: app 12 | image: raelga/cats:liam -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/304_simple-rs-nocolor-update.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: ReplicaSet 4 | metadata: 5 | name: simple 6 | spec: 7 | replicas: 1 8 | selector: 9 | matchLabels: 10 | app: simple 11 | matchExpressions: 12 | - { key: color, operator: DoesNotExist } 13 | template: 14 | metadata: 15 | labels: 16 | app: simple 17 | spec: 18 | containers: 19 | - name: app 20 | image: raelga/cats:gatet -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/305_simple-nocolor-rs.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: ReplicaSet 4 | metadata: 5 | name: simple-nocolor 6 | labels: 7 | app: simple 8 | spec: 9 | replicas: 5 10 | selector: 11 | matchLabels: 12 | app: simple 13 | matchExpressions: 14 | - { key: color, operator: DoesNotExist } 15 | template: 16 | metadata: 17 | labels: 18 | app: simple 19 | spec: 20 | containers: 21 | - name: app 22 | image: raelga/cats:gatet 23 | -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/306_simple-orange-pods.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: simple-orange-pod-1 6 | labels: 7 | app: simple 8 | color: orange 9 | spec: 10 | containers: 11 | - name: app 12 | image: raelga/cats:lia 13 | --- 14 | apiVersion: v1 15 | kind: Pod 16 | metadata: 17 | name: simple-orange-pod-2 18 | labels: 19 | app: simple 20 | color: orange 21 | spec: 22 | containers: 23 | - name: app 24 | image: raelga/cats:lia 25 | --- 26 | apiVersion: v1 27 | kind: Pod 28 | metadata: 29 | name: simple-orange-pod-3 30 | labels: 31 | app: simple 32 | color: orange 33 | spec: 34 | containers: 35 | - name: app 36 | image: raelga/cats:lia -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/307_simple-orange-rs.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: ReplicaSet 4 | metadata: 5 | name: simple-orange 6 | spec: 7 | replicas: 6 8 | selector: 9 | matchLabels: 10 | app: simple 11 | color: orange 12 | template: 13 | metadata: 14 | labels: 15 | app: simple 16 | color: orange 17 | spec: 18 | containers: 19 | - name: app 20 | image: raelga/cats:lia 21 | -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/400_probes-rs-readiness.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes 5 | labels: 6 | app: probes 7 | spec: 8 | replicas: 2 9 | selector: 10 | matchLabels: 11 | app: probes 12 | template: 13 | metadata: 14 | labels: 15 | app: probes 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:neu 20 | readinessProbe: 21 | tcpSocket: 22 | port: 80 23 | initialDelaySeconds: 10 24 | periodSeconds: 5 25 | successThreshold: 3 26 | -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/401_probes-rs-readiness-ko.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes 5 | labels: 6 | app: probes 7 | spec: 8 | replicas: 4 9 | selector: 10 | matchLabels: 11 | app: probes 12 | template: 13 | metadata: 14 | labels: 15 | app: probes 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:neu 20 | readinessProbe: 21 | tcpSocket: 22 | port: 81 23 | initialDelaySeconds: 10 24 | periodSeconds: 5 25 | successThreshold: 3 26 | -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/402_probes-rs-liveness.yaml: -------------------------------------------------------------------------------- 1 | 2 | apiVersion: apps/v1 3 | kind: ReplicaSet 4 | metadata: 5 | name: probes 6 | labels: 7 | app: probes 8 | spec: 9 | replicas: 6 10 | selector: 11 | matchLabels: 12 | app: probes 13 | template: 14 | metadata: 15 | labels: 16 | app: probes 17 | spec: 18 | containers: 19 | - name: app 20 | image: raelga/cats:neu 21 | livenessProbe: 22 | httpGet: 23 | path: / 24 | port: 80 25 | initialDelaySeconds: 10 26 | periodSeconds: 5 27 | failureThreshold: 2 -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/403_probes-rs-liveness-ko.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes 5 | labels: 6 | app: probes 7 | spec: 8 | replicas: 8 9 | selector: 10 | matchLabels: 11 | app: probes 12 | template: 13 | metadata: 14 | labels: 15 | app: probes 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:neu 20 | readinessProbe: 21 | tcpSocket: 22 | port: 80 23 | initialDelaySeconds: 10 24 | periodSeconds: 5 25 | successThreshold: 3 26 | livenessProbe: 27 | httpGet: 28 | path: /bad-endpoint 29 | port: 80 30 | initialDelaySeconds: 10 31 | periodSeconds: 5 32 | failureThreshold: 2 -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/501_probes-images-rs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes-images 5 | labels: 6 | app: probes-images 7 | spec: 8 | replicas: 3 9 | selector: 10 | matchLabels: 11 | app: probes-images 12 | template: 13 | metadata: 14 | labels: 15 | app: probes-images 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:neu 20 | readinessProbe: 21 | httpGet: 22 | path: / 23 | port: 80 24 | initialDelaySeconds: 2 25 | livenessProbe: 26 | httpGet: 27 | path: / 28 | port: 80 29 | initialDelaySeconds: 10 30 | periodSeconds: 5 31 | failureThreshold: 2 -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/502_probes-images-rs-update-image-ko.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes-images 5 | labels: 6 | app: probes-images 7 | spec: 8 | replicas: 3 9 | selector: 10 | matchLabels: 11 | app: probes-images 12 | template: 13 | metadata: 14 | labels: 15 | app: probes-images 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:blanca 20 | readinessProbe: 21 | httpGet: 22 | path: /bad-endpoint 23 | port: 80 24 | initialDelaySeconds: 2 25 | livenessProbe: 26 | httpGet: 27 | path: / 28 | port: 80 29 | initialDelaySeconds: 10 30 | periodSeconds: 5 31 | failureThreshold: 2 -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/503_probes-images-rs-6-update-image-ko.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes-images 5 | labels: 6 | app: probes-images 7 | spec: 8 | replicas: 6 9 | selector: 10 | matchLabels: 11 | app: probes-images 12 | template: 13 | metadata: 14 | labels: 15 | app: probes-images 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:blanca 20 | readinessProbe: 21 | httpGet: 22 | path: /bad-endpoint 23 | port: 80 24 | initialDelaySeconds: 2 25 | livenessProbe: 26 | httpGet: 27 | path: / 28 | port: 80 29 | initialDelaySeconds: 10 30 | periodSeconds: 5 31 | failureThreshold: 2 -------------------------------------------------------------------------------- /course/kubernetes/labs/02-ReplicaSets/504_probes-images-rs-9-update-image-ok.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes-images 5 | labels: 6 | app: probes-images 7 | spec: 8 | replicas: 9 9 | selector: 10 | matchLabels: 11 | app: probes-images 12 | template: 13 | metadata: 14 | labels: 15 | app: probes-images 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:blanca 20 | readinessProbe: 21 | httpGet: 22 | path: / 23 | port: 80 24 | initialDelaySeconds: 2 25 | livenessProbe: 26 | httpGet: 27 | path: / 28 | port: 80 29 | initialDelaySeconds: 10 30 | periodSeconds: 5 31 | failureThreshold: 2 -------------------------------------------------------------------------------- /course/kubernetes/labs/03-Storage/03.1-ConfigMaps/shell/game-config-configmap-v2.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: game-config 5 | data: 6 | game.properties: | 7 | version=v2 8 | enemies=aliens 9 | lives=3 10 | enemies.cheat=true 11 | enemies.cheat.level=noGoodRotten 12 | secret.code.passphrase=UUDDLRLRBABAS 13 | secret.code.allowed=true 14 | secret.code.lives=30 15 | ui.properties: | 16 | color.good=purple 17 | color.bad=yellow 18 | allow.textmode=true 19 | how.nice.to.look=fairlyNice 20 | -------------------------------------------------------------------------------- /course/kubernetes/labs/03-Storage/03.1-ConfigMaps/shell/game-config-configmap.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: game-config 5 | data: 6 | game.properties: | 7 | version=v1 8 | enemies=aliens 9 | lives=3 10 | enemies.cheat=true 11 | enemies.cheat.level=noGoodRotten 12 | secret.code.passphrase=UUDDLRLRBABAS 13 | secret.code.allowed=true 14 | secret.code.lives=30 15 | ui.properties: | 16 | color.good=purple 17 | color.bad=yellow 18 | allow.textmode=true 19 | how.nice.to.look=fairlyNice 20 | -------------------------------------------------------------------------------- /course/kubernetes/labs/03-Storage/03.1-ConfigMaps/shell/game-env-configmap.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: game-env 5 | data: 6 | debug_level: "10" 7 | environment: testing 8 | -------------------------------------------------------------------------------- /course/kubernetes/labs/03-Storage/03.2-Secrets/secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: secret-config 5 | data: 6 | .secret-file: SG9sYSBlbiBiYXNlIDY0Cg== 7 | secret-key: SG9sYSBkZXNkZSBlbCBMYWIK 8 | -------------------------------------------------------------------------------- /course/kubernetes/labs/03-Storage/03.3-Volumes/pvc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | name: volumen-pvc 5 | spec: 6 | accessModes: 7 | - ReadWriteOnce 8 | resources: 9 | requests: 10 | storage: 3Gi 11 | -------------------------------------------------------------------------------- /course/kubernetes/labs/03-Storage/03.3-Volumes/shell.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: shell-volumes 6 | labels: 7 | app: shell 8 | spec: 9 | volumes: 10 | - name: tmp-data 11 | emptyDir: {} 12 | - name: data 13 | persistentVolumeClaim: 14 | claimName: volumen-pvc 15 | containers: 16 | - name: shell 17 | image: raelga/toolbox 18 | command: ["bash", "-c", "sleep 3600"] 19 | volumeMounts: 20 | - mountPath: "/data" 21 | name: data 22 | - mountPath: "/tmp-data" 23 | name: tmp-data 24 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.1-replicaset/service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: cats 6 | labels: 7 | app: cats 8 | spec: 9 | ports: 10 | - port: 80 11 | targetPort: http-server 12 | selector: 13 | app: cats 14 | type: LoadBalancer 15 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/01-cats/service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: cats 6 | labels: 7 | app: cats 8 | spec: 9 | ports: 10 | - port: 80 11 | targetPort: http-server 12 | selector: 13 | app: cats 14 | type: LoadBalancer 15 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/app-v1/.gitignore: -------------------------------------------------------------------------------- 1 | guestbook_bin 2 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/app-v1/public/upc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/app-v1/public/upc.png -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/app-v2/.gitignore: -------------------------------------------------------------------------------- 1 | guestbook_bin 2 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/app-v2/public/upc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/app-v2/public/upc.png -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/app-v3/.gitignore: -------------------------------------------------------------------------------- 1 | guestbook_bin 2 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/app-v3/public/upc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/app-v3/public/upc.png -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/guestbook-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/guestbook-page.png -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/k8s/guestbook-service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: guestbook 6 | labels: 7 | app: guestbook 8 | spec: 9 | ports: 10 | - port: 80 11 | targetPort: http-server 12 | selector: 13 | app: guestbook 14 | type: LoadBalancer 15 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/k8s/redis-master-service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: redis-master 6 | labels: 7 | app: redis 8 | role: master 9 | spec: 10 | ports: 11 | - port: 6379 12 | targetPort: redis-server 13 | selector: 14 | app: redis 15 | role: master -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/03-guestbook/terraform.tfstate: -------------------------------------------------------------------------------- 1 | { 2 | "version": 4, 3 | "terraform_version": "1.9.2", 4 | "serial": 1, 5 | "lineage": "c814d499-a65f-9147-d38a-c8b60c7b1cba", 6 | "outputs": {}, 7 | "resources": [], 8 | "check_results": null 9 | } 10 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.2-deployment/04-wordpress/mysql-credentials-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: mysql-credentials 5 | stringData: 6 | db: wordpress 7 | user: wordpress 8 | password: admin 9 | rootPassword: root 10 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.3-statefulset/README.md: -------------------------------------------------------------------------------- 1 | ### MySQL StatefulSet 2 | 3 | ``` 4 | kubectl apply -f mysql-sts.yaml 5 | ``` 6 | 7 | ``` 8 | kubectl get -n default pvc,pv,storageclass 9 | ``` 10 | 11 | kubectl patch storageclass gp2 -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' 12 | 13 | 14 | ### Ephemeral Containers 15 | 16 | ``` 17 | kubectl debug pod/mysql-0 --image=mysql -ti -- mysql -h 127.0.0.1 -padmin 18 | ``` 19 | 20 | ### Check for issues 21 | 22 | ``` 23 | kubectl describe pod mysql-0 24 | ``` 25 | 26 | ### Deploy a wordpress with a PVC 27 | 28 | ``` 29 | kubectl apply -f wordpress-deployment.yaml 30 | ``` 31 | 32 | ### Get the wordpress load balancer 33 | 34 | ``` 35 | kubectl get svc wordpress 36 | ``` 37 | 38 | ### Cleanup 39 | 40 | ``` 41 | kubectl delete -f . 42 | ``` -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.3-statefulset/mysql-credentials-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: mysql-credentials 5 | stringData: 6 | db: wordpress 7 | user: wordpress 8 | password: admin 9 | rootPassword: root 10 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.5-jobs/README.md: -------------------------------------------------------------------------------- 1 | ## Hello Job 2 | 3 | ### Deploy 1 jobs with 5 executions 4 | 5 | ``` 6 | kubectl apply -f job-5.yaml 7 | ``` 8 | 9 | ``` 10 | kubectl get pods -l app=hello 11 | ``` 12 | 13 | ### Deploy manually job several times 14 | 15 | ! Check the Downward API implementation 16 | 17 | ``` 18 | kubectl apply -f job-manual.yaml 19 | ``` 20 | 21 | Raises an error due to the `generateName` usage. 22 | 23 | ``` 24 | kubectl create -f job-manual.yaml 25 | ``` 26 | 27 | ``` 28 | kubectl get pods -l app=hello 29 | ``` 30 | 31 | ### Schedule a job 32 | 33 | ``` 34 | kubectl apply -f cronjob.yaml 35 | ``` 36 | 37 | ``` 38 | kubectl get pods -l app=hello -w 39 | ``` 40 | 41 | ``` 42 | k logs -l app=hello --ignore-errors 43 | ``` 44 | 45 | ### Cleanup 46 | 47 | ``` 48 | kubectl delete all -l app=hello 49 | ``` 50 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.8-application-bundles/02-helm-hello/.gitignore: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.8-application-bundles/03-helm+operators/.gitignore: -------------------------------------------------------------------------------- 1 | prometheus 2 | cert-manager 3 | external-dns 4 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.8-application-bundles/03-helm+operators/guestbook/guestbook-service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: guestbook 6 | labels: 7 | app: guestbook 8 | spec: 9 | ports: 10 | - port: 80 11 | targetPort: http-server 12 | selector: 13 | app: guestbook 14 | type: LoadBalancer 15 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.8-application-bundles/03-helm+operators/guestbook/redis-master-service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: redis-master 6 | labels: 7 | app: redis 8 | role: master 9 | spec: 10 | ports: 11 | - port: 6379 12 | targetPort: redis-server 13 | selector: 14 | app: redis 15 | role: master -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.8-application-bundles/03-helm+operators/letsencrypt-production-clusterissuer.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cert-manager.io/v1 2 | kind: ClusterIssuer 3 | metadata: 4 | name: letsencrypt-production 5 | namespace: cert-manager 6 | spec: 7 | acme: 8 | # The ACME server URL 9 | server: "https://acme-v02.api.letsencrypt.org/directory" 10 | # Email address used for ACME registration 11 | email: rael@rael.io 12 | # Name of a secret used to store the ACME account private key 13 | privateKeySecretRef: 14 | name: letsencrypt-production 15 | # Enable the HTTP-01 challenge provider 16 | solvers: 17 | - http01: 18 | ingress: 19 | class: nginx 20 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.8-application-bundles/03-helm+operators/selfsigned-clusterissuer.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cert-manager.io/v1 2 | kind: ClusterIssuer 3 | metadata: 4 | name: selfsigned 5 | spec: 6 | selfSigned: {} 7 | --- 8 | apiVersion: cert-manager.io/v1 9 | kind: Certificate 10 | metadata: 11 | name: rael-ca 12 | namespace: cert-manager 13 | spec: 14 | isCA: true 15 | commonName: rael-ca 16 | secretName: rael-ca 17 | issuerRef: 18 | name: selfsigned 19 | kind: ClusterIssuer 20 | group: cert-manager.io 21 | --- 22 | apiVersion: cert-manager.io/v1 23 | kind: ClusterIssuer 24 | metadata: 25 | name: rael-ca 26 | spec: 27 | ca: 28 | secretName: rael-ca 29 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.8-application-bundles/05-kustomize/README.md: -------------------------------------------------------------------------------- 1 | k### Service version 2 | 3 | ``` 4 | kubectl apply -k argocd/service 5 | ``` 6 | 7 | ### Ingress version 8 | 9 | ``` 10 | kubectl apply -k argocd/ingress 11 | ``` 12 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.8-application-bundles/05-kustomize/argocd/bases/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | namespace: default 5 | 6 | resources: 7 | - github.com/argoproj/argo-cd/manifests/crds?ref=v2.6.2 8 | - github.com/argoproj/argo-cd/manifests/ha/base?ref=v2.6.2 9 | # - namespace.yaml 10 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.8-application-bundles/05-kustomize/argocd/ingress/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | namespace: argocd 5 | 6 | resources: 7 | - ../bases 8 | - ingress.yaml 9 | 10 | patches: 11 | - target: 12 | version: v1 13 | kind: Service 14 | name: argocd-server 15 | patch: |- 16 | - op: replace 17 | path: /spec/type 18 | value: NodePort 19 | 20 | # value: LoadBalancer 21 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.8-application-bundles/05-kustomize/argocd/service/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | namespace: argocd 5 | 6 | resources: 7 | - ../bases 8 | 9 | patches: 10 | - target: 11 | version: v1 12 | kind: Service 13 | name: argocd-server 14 | patch: |- 15 | - op: replace 16 | path: /spec/type 17 | value: LoadBalancer 18 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/.gitignore: -------------------------------------------------------------------------------- 1 | app/vendor 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/01-recreate/grafana-recreate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/01-recreate/grafana-recreate.png -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/02-ramped/grafana-ramped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/02-ramped/grafana-ramped.png -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/03-blue-green/grafana-blue-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/03-blue-green/grafana-blue-green.png -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/03-blue-green/multiple-services/ingress-v1.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Ingress 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | annotations: 8 | kubernetes.io/ingress.class: traefik 9 | spec: 10 | rules: 11 | - host: a.domain.com 12 | http: 13 | paths: 14 | - backend: 15 | serviceName: my-app-a-v1 16 | servicePort: 80 17 | - host: b.domain.com 18 | http: 19 | paths: 20 | - backend: 21 | serviceName: my-app-b-v1 22 | servicePort: 80 23 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/03-blue-green/multiple-services/ingress-v2.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Ingress 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | annotations: 8 | kubernetes.io/ingress.class: traefik 9 | spec: 10 | rules: 11 | - host: a.domain.com 12 | http: 13 | paths: 14 | - backend: 15 | serviceName: my-app-a-v2 16 | servicePort: 80 17 | - host: b.domain.com 18 | http: 19 | paths: 20 | - backend: 21 | serviceName: my-app-b-v2 22 | servicePort: 80 23 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/03-blue-green/single-service/service-internal-v2.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: my-app-internal 5 | labels: 6 | app: my-app 7 | spec: 8 | type: ClusterIP 9 | ports: 10 | - name: http 11 | port: 80 12 | targetPort: http 13 | 14 | # Note here that we match both the app and the version 15 | selector: 16 | app: my-app 17 | version: v2.0.0 18 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/03-blue-green/single-service/service-v1.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | type: LoadBalancer 9 | ports: 10 | - name: http 11 | port: 80 12 | targetPort: http 13 | 14 | # Note here that we match both the app and the version 15 | selector: 16 | app: my-app 17 | version: v1.0.0 -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/03-blue-green/single-service/service-v2.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: my-app-v2 5 | labels: 6 | app: my-app 7 | spec: 8 | type: LoadBalancer 9 | ports: 10 | - name: http 11 | port: 80 12 | targetPort: http 13 | 14 | # Note here that we match both the app and the version 15 | selector: 16 | app: my-app 17 | version: v2.0.0 18 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/04-canary/grafana-canary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/04-canary/grafana-canary.png -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/04-canary/istio/hpa.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: autoscaling/v1 2 | kind: HorizontalPodAutoscaler 3 | metadata: 4 | name: my-app-v1 5 | spec: 6 | maxReplicas: 10 7 | minReplicas: 1 8 | scaleTargetRef: 9 | apiVersion: extensions/v1beta1 10 | kind: Deployment 11 | name: my-app-v1 12 | targetCPUUtilizationPercentage: 50 13 | --- 14 | apiVersion: autoscaling/v1 15 | kind: HorizontalPodAutoscaler 16 | metadata: 17 | name: my-app-v2 18 | spec: 19 | maxReplicas: 10 20 | minReplicas: 1 21 | scaleTargetRef: 22 | apiVersion: extensions/v1beta1 23 | kind: Deployment 24 | name: my-app-v2 25 | targetCPUUtilizationPercentage: 50 26 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/04-canary/nginx-ingress/ingress-v1.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | ingressClassName: nginx 9 | rules: 10 | - host: my-app.com 11 | http: 12 | paths: 13 | - pathType: Prefix 14 | path: / 15 | backend: 16 | service: 17 | name: my-app-v1 18 | port: 19 | number: 80 20 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/04-canary/nginx-ingress/ingress-v2-canary.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | name: my-app-canary 5 | labels: 6 | app: my-app 7 | annotations: 8 | # Enable canary and send 10% of traffic to version 2 9 | nginx.ingress.kubernetes.io/canary: "true" 10 | nginx.ingress.kubernetes.io/canary-weight: "10" 11 | spec: 12 | ingressClassName: nginx 13 | rules: 14 | - host: my-app.com 15 | http: 16 | paths: 17 | - pathType: Prefix 18 | path: / 19 | backend: 20 | service: 21 | name: my-app-v2 22 | port: 23 | number: 80 24 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/04-canary/nginx-ingress/ingress-v2.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | ingressClassName: nginx 9 | rules: 10 | - host: my-app.com 11 | http: 12 | paths: 13 | - pathType: Prefix 14 | path: / 15 | backend: 16 | service: 17 | name: my-app-v2 18 | port: 19 | number: 80 20 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/05-ab-testing/gke/ingress-v1.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "networking.k8s.io/v1" 3 | kind: "Ingress" 4 | metadata: 5 | name: "my-app" 6 | spec: 7 | defaultBackend: 8 | service: 9 | name: "my-app-v1" 10 | port: 11 | number: 80 12 | rules: 13 | - host: "my-app.rael.io" 14 | http: 15 | paths: 16 | - path: "" 17 | backend: 18 | service: 19 | name: "my-app-v1" 20 | port: 21 | number: 80 22 | pathType: "ImplementationSpecific" 23 | status: 24 | loadBalancer: {} 25 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/05-ab-testing/gke/ingress-v2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "networking.k8s.io/v1" 3 | kind: "Ingress" 4 | metadata: 5 | name: "my-app" 6 | spec: 7 | defaultBackend: 8 | service: 9 | name: "my-app-v1" 10 | port: 11 | number: 80 12 | rules: 13 | - host: "my-app.rael.io" 14 | http: 15 | paths: 16 | - path: "" 17 | backend: 18 | service: 19 | name: "my-app-v2" 20 | port: 21 | number: 80 22 | pathType: "ImplementationSpecific" 23 | status: 24 | loadBalancer: {} 25 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/05-ab-testing/grafana-ab-testing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/05-ab-testing/grafana-ab-testing.png -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/05-ab-testing/istio/gateway.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: Gateway 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | servers: 9 | - port: 10 | number: 80 11 | name: http 12 | protocol: HTTP 13 | hosts: 14 | - my-app.local 15 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/05-ab-testing/istio/virtualservice-match.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: VirtualService 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | hosts: 9 | - my-app.local 10 | gateways: 11 | - my-app 12 | http: 13 | - route: 14 | - destination: 15 | host: my-app-v1 16 | match: 17 | - headers: 18 | x-api-version: 19 | exact: v1.0.0 20 | - route: 21 | - destination: 22 | host: my-app-v2 23 | match: 24 | - headers: 25 | x-api-version: 26 | exact: v2.0.0 27 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/05-ab-testing/istio/virtualservice-weight.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: VirtualService 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | hosts: 9 | - my-app.local 10 | gateways: 11 | - my-app 12 | http: 13 | - route: 14 | - destination: 15 | host: my-app-v1 16 | weight: 90 17 | - destination: 18 | host: my-app-v2 19 | weight: 10 20 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/05-ab-testing/istio/virtualservice.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: VirtualService 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | hosts: 9 | - my-app.local 10 | gateways: 11 | - my-app 12 | http: 13 | - route: 14 | - destination: 15 | host: my-app-v1 16 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/06-shadow/gateway.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: Gateway 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | servers: 9 | - port: 10 | number: 80 11 | name: http 12 | protocol: HTTP 13 | hosts: 14 | - my-app.local 15 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/06-shadow/grafana-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/06-shadow/grafana-shadow.png -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/06-shadow/virtualservice-mirror.yaml: -------------------------------------------------------------------------------- 1 | # Mirror traffic to v2.0.0 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: my-app 6 | labels: 7 | app: my-app 8 | spec: 9 | hosts: 10 | - my-app.local 11 | gateways: 12 | - my-app 13 | http: 14 | - route: 15 | - destination: 16 | host: my-app-v1 17 | mirror: 18 | host: my-app-v2 19 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/06-shadow/virtualservice.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: VirtualService 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | hosts: 9 | - my-app.local 10 | gateways: 11 | - my-app 12 | http: 13 | - route: 14 | - destination: 15 | host: my-app-v1 16 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/app/.dockerignore: -------------------------------------------------------------------------------- 1 | vendor 2 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.17 AS build 2 | 3 | WORKDIR /src 4 | 5 | # Download Go modules 6 | COPY go.mod go.sum ./ 7 | RUN go mod download 8 | 9 | COPY *.go ./ 10 | 11 | RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . 12 | 13 | FROM scratch 14 | COPY --from=build /src/app /app 15 | EXPOSE 8080 8086 9101 16 | CMD ["/app"] 17 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/app/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all build test-all test lint vet 2 | 3 | all: test-all build 4 | 5 | build: 6 | docker build --no-cache -t raelga/k8s-deployment-strategies:latest . 7 | 8 | test-all: vet lint test 9 | 10 | test: 11 | go test -v -parallel=4 ./... 12 | 13 | lint: 14 | @go get golang.org/x/lint 15 | go list ./... | xargs -n1 golint 16 | 17 | vet: 18 | go vet ./... 19 | -------------------------------------------------------------------------------- /course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/decision-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/04-Deployments/04.9-deployment-strategies/decision-diagram.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/images/aks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/images/aks.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/images/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/images/demo.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/images/eks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/images/eks.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/images/gke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/images/gke.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/01-providers/aws/eks/iam/AmazonEKSServiceRole.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2012-10-17", 3 | "Statement": [ 4 | { 5 | "Effect": "Allow", 6 | "Principal": { 7 | "Service": "eks.amazonaws.com" 8 | }, 9 | "Action": "sts:AssumeRole" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/01-providers/aws/eks/manifests/eks-admin-binding-role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1beta1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: eks-admin 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: cluster-admin 9 | subjects: 10 | - kind: ServiceAccount 11 | name: eks-admin 12 | namespace: kube-system -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/01-providers/aws/eks/manifests/eks-admin-service-account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: eks-admin 5 | namespace: kube-system -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/01-providers/aws/eks/manifests/eks-kubeconfig.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | clusters: 3 | - cluster: 4 | server: 5 | certificate-authority-data: 6 | name: 7 | contexts: 8 | - context: 9 | cluster: 10 | user: k8s 11 | name: 12 | kind: Config 13 | preferences: {} 14 | users: 15 | - name: k8s 16 | user: 17 | exec: 18 | apiVersion: client.authentication.k8s.io/v1alpha1 19 | command: heptio-authenticator-aws 20 | args: 21 | - "token" 22 | - "-i" 23 | - "" -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/01-providers/aws/eks/manifests/k8s-aws-auth-cm.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: aws-auth 5 | namespace: kube-system 6 | data: 7 | mapRoles: | 8 | - rolearn: 9 | username: system:node:{{EC2PrivateDNSName}} 10 | groups: 11 | - system:bootstrappers 12 | - system:nodes 13 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/01-providers/aws/eks/manifests/manifests/eks-admin-binding-role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1beta1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: eks-admin 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: cluster-admin 9 | subjects: 10 | - kind: ServiceAccount 11 | name: eks-admin 12 | namespace: kube-system -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/01-providers/aws/eks/manifests/manifests/eks-admin-service-account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: eks-admin 5 | namespace: kube-system -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/01-providers/aws/eks/manifests/manifests/eks-kubeconfig.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | clusters: 3 | - cluster: 4 | server: 5 | certificate-authority-data: 6 | name: 7 | contexts: 8 | - context: 9 | cluster: 10 | user: k8s 11 | name: .talks.aws.rael.io 12 | kind: Config 13 | preferences: {} 14 | users: 15 | - name: k8s 16 | user: 17 | exec: 18 | apiVersion: client.authentication.k8s.io/v1alpha1 19 | command: heptio-authenticator-aws 20 | args: 21 | - "token" 22 | - "-i" 23 | - "" 24 | env: 25 | - name: AWS_PROFILE 26 | value: "k8s-talks" -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/01-providers/aws/eks/manifests/manifests/k8s-aws-auth-cm.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: aws-auth 5 | namespace: kube-system 6 | data: 7 | mapRoles: | 8 | - rolearn: 9 | username: system:node:{{EC2PrivateDNSName}} 10 | groups: 11 | - system:bootstrappers 12 | - system:nodes 13 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/01-providers/aws/eks/route53/CustomRoute53RecordSet.json: -------------------------------------------------------------------------------- 1 | { 2 | "Comment": "Update record to reflect new cluster endpoint", 3 | "Changes": [ 4 | { 5 | "Action": "UPSERT", 6 | "ResourceRecordSet": { 7 | "Name": "api.eks.talks.aws.rael.io.", 8 | "Type": "CNAME", 9 | "TTL": 300, 10 | "ResourceRecords": [ 11 | { 12 | "Value": "" 13 | } 14 | ] 15 | } 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/02-guestbook/README.md: -------------------------------------------------------------------------------- 1 | ## Guestbook Example 2 | 3 | This example shows how to build a simple multi-tier web application using Kubernetes and Docker. The application consists of a web front end, Redis master for storage, and replicated set of Redis slaves, all for which we will create Kubernetes replication controllers, pods, and services. 4 | 5 | ![Guestbook](guestbook-page.png) -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/02-guestbook/app/.gitignore: -------------------------------------------------------------------------------- 1 | guestbook_bin 2 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/02-guestbook/app/public/upc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/labs/02-guestbook/app/public/upc.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/02-guestbook/guestbook-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/labs/02-guestbook/guestbook-page.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/02-guestbook/k8s/guestbook-service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: guestbook 6 | labels: 7 | app: guestbook 8 | spec: 9 | ports: 10 | - port: 80 11 | targetPort: http-server 12 | selector: 13 | app: guestbook 14 | type: LoadBalancer 15 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/02-guestbook/k8s/redis-master-service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: redis-master 6 | labels: 7 | app: redis 8 | role: master 9 | spec: 10 | ports: 11 | - port: 6379 12 | targetPort: redis-server 13 | selector: 14 | app: redis 15 | role: master -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/.gitignore: -------------------------------------------------------------------------------- 1 | app/vendor 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/01-recreate/grafana-recreate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/01-recreate/grafana-recreate.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/02-ramped/grafana-ramped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/02-ramped/grafana-ramped.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/03-blue-green/grafana-blue-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/03-blue-green/grafana-blue-green.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/03-blue-green/multiple-services/ingress-v1.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Ingress 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | annotations: 8 | kubernetes.io/ingress.class: traefik 9 | spec: 10 | rules: 11 | - host: a.domain.com 12 | http: 13 | paths: 14 | - backend: 15 | serviceName: my-app-a-v1 16 | servicePort: 80 17 | - host: b.domain.com 18 | http: 19 | paths: 20 | - backend: 21 | serviceName: my-app-b-v1 22 | servicePort: 80 23 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/03-blue-green/multiple-services/ingress-v2.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Ingress 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | annotations: 8 | kubernetes.io/ingress.class: traefik 9 | spec: 10 | rules: 11 | - host: a.domain.com 12 | http: 13 | paths: 14 | - backend: 15 | serviceName: my-app-a-v2 16 | servicePort: 80 17 | - host: b.domain.com 18 | http: 19 | paths: 20 | - backend: 21 | serviceName: my-app-b-v2 22 | servicePort: 80 23 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/03-blue-green/single-service/svc-v2.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: my-app-v2 5 | labels: 6 | app: my-app 7 | spec: 8 | type: LoadBalancer 9 | ports: 10 | - name: http 11 | port: 80 12 | targetPort: http 13 | 14 | # Note here that we match both the app and the version 15 | selector: 16 | app: my-app 17 | version: v2.0.0 18 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/04-canary/grafana-canary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/04-canary/grafana-canary.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/04-canary/istio/hpa.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: autoscaling/v1 2 | kind: HorizontalPodAutoscaler 3 | metadata: 4 | name: my-app-v1 5 | spec: 6 | maxReplicas: 10 7 | minReplicas: 1 8 | scaleTargetRef: 9 | apiVersion: extensions/v1beta1 10 | kind: Deployment 11 | name: my-app-v1 12 | targetCPUUtilizationPercentage: 50 13 | --- 14 | apiVersion: autoscaling/v1 15 | kind: HorizontalPodAutoscaler 16 | metadata: 17 | name: my-app-v2 18 | spec: 19 | maxReplicas: 10 20 | minReplicas: 1 21 | scaleTargetRef: 22 | apiVersion: extensions/v1beta1 23 | kind: Deployment 24 | name: my-app-v2 25 | targetCPUUtilizationPercentage: 50 26 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/04-canary/nginx-ingress/ingress-v1.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Ingress 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | annotations: 8 | kubernetes.io/ingress.class: "nginx" 9 | spec: 10 | rules: 11 | - host: my-app.com 12 | http: 13 | paths: 14 | - backend: 15 | serviceName: my-app-v1 16 | servicePort: 80 17 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/04-canary/nginx-ingress/ingress-v2-canary.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Ingress 3 | metadata: 4 | name: my-app-canary 5 | labels: 6 | app: my-app 7 | annotations: 8 | kubernetes.io/ingress.class: "nginx" 9 | 10 | # Enable canary and send 10% of traffic to version 2 11 | nginx.ingress.kubernetes.io/canary: "true" 12 | nginx.ingress.kubernetes.io/canary-weight: "10" 13 | spec: 14 | rules: 15 | - host: my-app.com 16 | http: 17 | paths: 18 | - backend: 19 | serviceName: my-app-v2 20 | servicePort: 80 21 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/04-canary/nginx-ingress/ingress-v2.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Ingress 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | annotations: 8 | kubernetes.io/ingress.class: "nginx" 9 | spec: 10 | rules: 11 | - host: my-app.com 12 | http: 13 | paths: 14 | - backend: 15 | serviceName: my-app-v2 16 | servicePort: 80 17 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/05-ab-testing/gke/ingress-v1.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "networking.k8s.io/v1" 3 | kind: "Ingress" 4 | metadata: 5 | name: "my-app" 6 | spec: 7 | defaultBackend: 8 | service: 9 | name: "my-app-v1" 10 | port: 11 | number: 80 12 | rules: 13 | - host: "my-app.rael.io" 14 | http: 15 | paths: 16 | - path: "" 17 | backend: 18 | service: 19 | name: "my-app-v1" 20 | port: 21 | number: 80 22 | pathType: "ImplementationSpecific" 23 | status: 24 | loadBalancer: {} 25 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/05-ab-testing/gke/ingress-v2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: "networking.k8s.io/v1" 3 | kind: "Ingress" 4 | metadata: 5 | name: "my-app" 6 | spec: 7 | defaultBackend: 8 | service: 9 | name: "my-app-v1" 10 | port: 11 | number: 80 12 | rules: 13 | - host: "my-app.rael.io" 14 | http: 15 | paths: 16 | - path: "" 17 | backend: 18 | service: 19 | name: "my-app-v2" 20 | port: 21 | number: 80 22 | pathType: "ImplementationSpecific" 23 | status: 24 | loadBalancer: {} 25 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/05-ab-testing/grafana-ab-testing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/05-ab-testing/grafana-ab-testing.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/05-ab-testing/istio/gateway.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: Gateway 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | servers: 9 | - port: 10 | number: 80 11 | name: http 12 | protocol: HTTP 13 | hosts: 14 | - my-app.local 15 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/05-ab-testing/istio/virtualservice-match.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: VirtualService 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | hosts: 9 | - my-app.local 10 | gateways: 11 | - my-app 12 | http: 13 | - route: 14 | - destination: 15 | host: my-app-v1 16 | match: 17 | - headers: 18 | x-api-version: 19 | exact: v1.0.0 20 | - route: 21 | - destination: 22 | host: my-app-v2 23 | match: 24 | - headers: 25 | x-api-version: 26 | exact: v2.0.0 27 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/05-ab-testing/istio/virtualservice-weight.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: VirtualService 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | hosts: 9 | - my-app.local 10 | gateways: 11 | - my-app 12 | http: 13 | - route: 14 | - destination: 15 | host: my-app-v1 16 | weight: 90 17 | - destination: 18 | host: my-app-v2 19 | weight: 10 20 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/05-ab-testing/istio/virtualservice.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: VirtualService 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | hosts: 9 | - my-app.local 10 | gateways: 11 | - my-app 12 | http: 13 | - route: 14 | - destination: 15 | host: my-app-v1 16 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/06-shadow/gateway.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: Gateway 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | servers: 9 | - port: 10 | number: 80 11 | name: http 12 | protocol: HTTP 13 | hosts: 14 | - my-app.local 15 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/06-shadow/grafana-shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/06-shadow/grafana-shadow.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/06-shadow/virtualservice-mirror.yaml: -------------------------------------------------------------------------------- 1 | # Mirror traffic to v2.0.0 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: my-app 6 | labels: 7 | app: my-app 8 | spec: 9 | hosts: 10 | - my-app.local 11 | gateways: 12 | - my-app 13 | http: 14 | - route: 15 | - destination: 16 | host: my-app-v1 17 | mirror: 18 | host: my-app-v2 19 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/06-shadow/virtualservice.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.istio.io/v1alpha3 2 | kind: VirtualService 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | hosts: 9 | - my-app.local 10 | gateways: 11 | - my-app 12 | http: 13 | - route: 14 | - destination: 15 | host: my-app-v1 16 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/app/.dockerignore: -------------------------------------------------------------------------------- 1 | vendor 2 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/app/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.17 AS build 2 | 3 | WORKDIR /src 4 | 5 | # Download Go modules 6 | COPY go.mod go.sum ./ 7 | RUN go mod download 8 | 9 | COPY *.go ./ 10 | 11 | RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . 12 | 13 | FROM scratch 14 | COPY --from=build /src/app /app 15 | EXPOSE 8080 8086 9101 16 | CMD ["/app"] 17 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/app/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all build test-all test lint vet 2 | 3 | all: test-all build 4 | 5 | build: 6 | docker build --no-cache -t raelga/k8s-deployment-strategies:latest . 7 | 8 | test-all: vet lint test 9 | 10 | test: 11 | go test -v -parallel=4 ./... 12 | 13 | lint: 14 | @go get golang.org/x/lint 15 | go list ./... | xargs -n1 golint 16 | 17 | vet: 18 | go vet ./... 19 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/decision-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/05-Providers/labs/03-deployment-strategies/decision-diagram.png -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/04-statefulset/README.md: -------------------------------------------------------------------------------- 1 | 2 | ### MySQL StatefulSet 3 | 4 | ``` 5 | kubectl apply -f mysql-sts.yaml 6 | ``` 7 | 8 | ``` 9 | kubectl get -n default pvc,pv,storageclass 10 | ``` 11 | 12 | ### Ephemeral Containers 13 | 14 | ``` 15 | kubectl debug pod/mysql-0 --image=mysql -ti -- mysql -h 127.0.0.1 -padmin 16 | ``` 17 | 18 | ### Deploy a wordpress with a PVC 19 | 20 | ``` 21 | kubectl apply -f wordpress-deployment.yaml 22 | ``` 23 | 24 | ### Get the wordpress load balancer 25 | 26 | ``` 27 | kubectl get svc wordpress 28 | ``` -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/04-statefulset/mysql-credentials-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: mysql-credentials 5 | stringData: 6 | db: wordpress 7 | user: wordpress 8 | password: admin 9 | rootPassword: root 10 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/05-daemonset/README.md: -------------------------------------------------------------------------------- 1 | 2 | ### Hostname DaemonSet 3 | 4 | ``` 5 | kubectl apply -f hostname-ds.yaml 6 | ``` 7 | 8 | ``` 9 | kubectl get pods -l app=hostname 10 | ``` 11 | 12 | ``` 13 | kubectl get nodes 14 | ``` 15 | 16 | Rollout a new version with the DownwardAPI volume 17 | 18 | ``` 19 | kubectl apply -f hostname-dwapi-ds.yaml 20 | ``` 21 | 22 | ``` 23 | kubectl get pods -l app=hostname -w 24 | ``` 25 | 26 | ``` 27 | kubectl exec -ti $(kubectl get pods -l app=hostname -o name --field-selector=status.phase==Running | head -n1) -- /bin/bash 28 | ``` 29 | 30 | Check /etc/podinfo folder. 31 | -------------------------------------------------------------------------------- /course/kubernetes/labs/05-Providers/labs/06-jobs/README.md: -------------------------------------------------------------------------------- 1 | 2 | ### Hello Job 3 | 4 | ``` 5 | kubectl apply -f hello-5-job.yaml 6 | ``` 7 | 8 | ``` 9 | kubectl get pods -l app=hello 10 | ``` 11 | 12 | ! Check the Downward API implementation 13 | 14 | ``` 15 | kubectl apply -f hello-5-generated-job.yaml 16 | ``` 17 | 18 | ``` 19 | kubectl create -f hello-5-generated-job.yaml 20 | ``` 21 | 22 | ``` 23 | kubectl get pods -l app=hello 24 | ``` 25 | 26 | ``` 27 | kubectl apply -f hello-cronjob.yaml 28 | ``` 29 | 30 | ``` 31 | kubectl get pods -l app=hello 32 | ``` 33 | 34 | ```` 35 | k logs -l app=hello --ignore-errors 36 | ``` -------------------------------------------------------------------------------- /course/kubernetes/labs/06-from-scratch/.gitignore: -------------------------------------------------------------------------------- 1 | .terraform 2 | *terraform*state* 3 | *lock.hcl -------------------------------------------------------------------------------- /course/kubernetes/labs/06-from-scratch/guestbook/app-v4/.gitignore: -------------------------------------------------------------------------------- 1 | guestbook_bin 2 | -------------------------------------------------------------------------------- /course/kubernetes/labs/06-from-scratch/guestbook/app-v4/public/upc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/course/kubernetes/labs/06-from-scratch/guestbook/app-v4/public/upc.png -------------------------------------------------------------------------------- /course/kubernetes/labs/06-from-scratch/guestbook/guestbook-service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: guestbook 6 | labels: 7 | app: guestbook 8 | spec: 9 | ports: 10 | - port: 80 11 | targetPort: http-server 12 | selector: 13 | app: guestbook 14 | type: NodePort 15 | -------------------------------------------------------------------------------- /course/kubernetes/labs/06-from-scratch/guestbook/redis-master-deployemt.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Deployment 3 | apiVersion: apps/v1 4 | metadata: 5 | name: redis-master 6 | labels: 7 | app: redis 8 | role: master 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: redis 14 | role: master 15 | template: 16 | metadata: 17 | labels: 18 | app: redis 19 | role: master 20 | spec: 21 | containers: 22 | - name: redis-master 23 | image: redis:3.2 24 | imagePullPolicy: Always 25 | ports: 26 | - name: redis-server 27 | containerPort: 6379 28 | resources: 29 | limits: 30 | memory: 128M 31 | cpu: 200m 32 | requests: 33 | memory: 128M 34 | cpu: 200m 35 | -------------------------------------------------------------------------------- /course/kubernetes/labs/06-from-scratch/guestbook/redis-master-service.yml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Service 3 | apiVersion: v1 4 | metadata: 5 | name: redis-master 6 | labels: 7 | app: redis 8 | role: master 9 | spec: 10 | ports: 11 | - port: 6379 12 | targetPort: redis-server 13 | selector: 14 | app: redis 15 | role: master -------------------------------------------------------------------------------- /course/kubernetes/labs/06-from-scratch/hello-manifests/hello-cm.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "name": "hello-cm" 6 | }, 7 | "data": { 8 | "GREETING": "Hello folks from kubectl" 9 | } 10 | } -------------------------------------------------------------------------------- /course/kubernetes/labs/06-from-scratch/hello-manifests/hello-svc.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: hello 5 | spec: 6 | type: NodePort 7 | selector: 8 | app: hello 9 | ports: 10 | - port: 80 11 | targetPort: 80 12 | -------------------------------------------------------------------------------- /course/kubernetes/labs/06-from-scratch/kubectl-cfg.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | clusters: 3 | - cluster: 4 | server: localhost:8080 5 | name: localhost 6 | contexts: 7 | - context: 8 | cluster: localhost 9 | user: "" 10 | name: localhost 11 | current-context: localhost 12 | kind: Config 13 | preferences: {} 14 | users: [] -------------------------------------------------------------------------------- /course/kubernetes/labs/06-from-scratch/my-app/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: my-app 5 | labels: 6 | app: my-app 7 | spec: 8 | type: NodePort 9 | ports: 10 | - name: http 11 | port: 80 12 | targetPort: http 13 | selector: 14 | app: my-app 15 | -------------------------------------------------------------------------------- /course/kubernetes/labs/09-last/00-ManagedCluser-GCP/app/app-v1/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.8.3 as builder 2 | WORKDIR /go/src/app 3 | COPY app.go . 4 | RUN CGO_ENABLED=0 GOOS=linux go build -a -o app . 5 | 6 | FROM alpine:latest 7 | RUN apk --no-cache add ca-certificates 8 | WORKDIR /root/ 9 | COPY --from=builder /go/src/app/app . 10 | CMD ["./app"] 11 | EXPOSE 9999 -------------------------------------------------------------------------------- /course/kubernetes/labs/09-last/00-ManagedCluser-GCP/app/app-v1/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker build . -t hello-world:v1 3 | 4 | run: 5 | docker run -p 9999:9999 -d hello-world:v1 6 | 7 | stop: 8 | docker stop $(docker ps -a --filter ancestor=hello-world:v1 -q) -------------------------------------------------------------------------------- /course/kubernetes/labs/09-last/00-ManagedCluser-GCP/app/app-v1/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net/http" 7 | ) 8 | 9 | // HelloWorld - Simple Hello World response 10 | func HelloWorld(w http.ResponseWriter, r *http.Request) { 11 | log.Print(r) 12 | fmt.Fprintf(w, "Hello World") 13 | } 14 | 15 | func main() { 16 | http.HandleFunc("/", HelloWorld) 17 | 18 | log.Println("Listeing at :9999...") 19 | err := http.ListenAndServe(":9999", nil) 20 | 21 | if err != nil { 22 | log.Fatal("Server ended, reason: ", err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /course/kubernetes/labs/09-last/00-ManagedCluser-GCP/app/app-v2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.8.3 as builder 2 | WORKDIR /go/src/app 3 | COPY app.go . 4 | RUN CGO_ENABLED=0 GOOS=linux go build -a -o app . 5 | 6 | FROM alpine:latest 7 | RUN apk --no-cache add ca-certificates 8 | WORKDIR /root/ 9 | COPY --from=builder /go/src/app/app . 10 | CMD ["./app"] 11 | EXPOSE 9999 -------------------------------------------------------------------------------- /course/kubernetes/labs/09-last/00-ManagedCluser-GCP/app/app-v2/Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | docker build . -t hello-world:v2 3 | 4 | run: 5 | docker run -p 9999:9999 -d hello-world:v2 6 | 7 | stop: 8 | docker stop $(docker ps -a --filter ancestor=hello-world:v2 -q -------------------------------------------------------------------------------- /course/kubernetes/labs/09-last/00-ManagedCluser-GCP/app/app-v2/app.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net/http" 7 | "os" 8 | ) 9 | 10 | // HelloWorld - Simple Hello World response 11 | func HelloWorld(w http.ResponseWriter, r *http.Request) { 12 | log.Print(r) 13 | hostname, _ := os.Hostname() 14 | fmt.Fprintf(w, "Hello World from %s", hostname) 15 | } 16 | 17 | func main() { 18 | http.HandleFunc("/", HelloWorld) 19 | 20 | log.Println("Listeing at :9999...") 21 | err := http.ListenAndServe(":9999", nil) 22 | 23 | if err != nil { 24 | log.Fatal("Server ended, reason: ", err) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /course/kubernetes/labs/09-last/02-rbac/pod.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: service-account-pod 5 | namespace: default 6 | spec: 7 | containers: 8 | - command: 9 | [ 10 | "/bin/bash", 11 | "-c", 12 | 'while true; do curl -s https://kubernetes:443/api/v1/namespaces/default/pods/service-account-pod --header "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" --insecure; sleep 10; done', 13 | ] 14 | image: raelga/toolbox 15 | name: pods-simple-container 16 | serviceAccount: service-account-pod-read 17 | -------------------------------------------------------------------------------- /course/kubernetes/labs/09-last/02-rbac/role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: Role 3 | metadata: 4 | name: role-pod-read 5 | namespace: default 6 | rules: 7 | - apiGroups: [""] 8 | resources: ["pods"] 9 | verbs: ["get", "watch", "list"] 10 | -------------------------------------------------------------------------------- /course/kubernetes/labs/09-last/02-rbac/rolebinding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: service-account-rolebinding 5 | namespace: default 6 | subjects: 7 | - kind: ServiceAccount 8 | name: service-account-pod-read 9 | roleRef: 10 | kind: Role 11 | name: role-pod-read 12 | apiGroup: rbac.authorization.k8s.io 13 | -------------------------------------------------------------------------------- /course/kubernetes/labs/09-last/02-rbac/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: service-account-pod-read 5 | namespace: default 6 | -------------------------------------------------------------------------------- /course/kubernetes/labs/09-last/04-eks+fargate/guestbook-ingress.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | name: gb 5 | annotations: 6 | alb.ingress.kubernetes.io/scheme: internet-facing 7 | alb.ingress.kubernetes.io/target-type: ip 8 | spec: 9 | ingressClassName: alb 10 | rules: 11 | - http: 12 | paths: 13 | - path: / 14 | pathType: Prefix 15 | backend: 16 | service: 17 | name: guestbook 18 | port: 19 | number: 80 20 | -------------------------------------------------------------------------------- /course/kubernetes/slides/README.md: -------------------------------------------------------------------------------- 1 | # Slides 2 | 3 | https://go.rael.dev/k8s-course 4 | -------------------------------------------------------------------------------- /course/terraform/aws-academy-ec2-instance/.gitignore: -------------------------------------------------------------------------------- 1 | .terraform 2 | *terraform*state* 3 | *lock.hcl -------------------------------------------------------------------------------- /course/terraform/aws-academy-ec2-instance/README.md: -------------------------------------------------------------------------------- 1 | # Notes 2 | 3 | ## AutoDeploy using AWS Academy Learner Lab console 4 | 5 | ```bash 6 | curl -sqL http://go.rael.dev/k8s-academy-ec2-llab-start | bash 7 | ``` 8 | 9 | ## Manual deploy. Create the stack in AWS (Terminal 1) 10 | 11 | https://us-east-1.console.aws.amazon.com/ec2/v2/home?region=us-east-1#Instances:instanceState=running 12 | 13 | ``` 14 | terraform init && terraform apply --var "github_user=YOUR_GH_USER_ID" 15 | ``` 16 | -------------------------------------------------------------------------------- /course/terraform/aws-academy-ec2-k8s-instance/.gitignore: -------------------------------------------------------------------------------- 1 | .terraform 2 | *terraform*state* 3 | *lock.hcl -------------------------------------------------------------------------------- /course/terraform/aws-academy-eks-managed-cluster/.gitignore: -------------------------------------------------------------------------------- 1 | .terraform 2 | *terraform*state* 3 | *lock.hcl -------------------------------------------------------------------------------- /course/terraform/aws-academy-eks-managed-cluster/modules/vpc/outputs.tf: -------------------------------------------------------------------------------- 1 | output "vpc_id" { 2 | value = aws_vpc.main.id 3 | } 4 | 5 | output "public_subnet_a" { 6 | value = aws_subnet.public_az_a.id 7 | } 8 | 9 | output "public_subnet_b" { 10 | value = aws_subnet.public_az_b.id 11 | } 12 | 13 | output "public_subnet_c" { 14 | value = aws_subnet.public_az_c.id 15 | } 16 | 17 | output "private_subnet_a" { 18 | value = aws_subnet.private_az_a.id 19 | } 20 | 21 | output "private_subnet_b" { 22 | value = aws_subnet.private_az_b.id 23 | } 24 | 25 | output "private_subnet_c" { 26 | value = aws_subnet.private_az_c.id 27 | } 28 | -------------------------------------------------------------------------------- /course/terraform/ec2-instance/.gitignore: -------------------------------------------------------------------------------- 1 | .terraform 2 | *terraform*state* 3 | *lock.hcl -------------------------------------------------------------------------------- /course/terraform/ec2-instance/aws-ec2-instance.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "eu-west-1" 3 | } 4 | 5 | module "vpc" { 6 | source = "./terraform/modules/aws/vpc/vpc" 7 | name = "scratch" 8 | } 9 | 10 | module "ec2" { 11 | source = "../modules/aws/ec2/spot-instance" 12 | name = "scratch" 13 | vpc = module.vpc.vpc_id 14 | subnet = module.vpc.subnet_az1_id 15 | system_user = "rael" 16 | github_user = "raelga" 17 | instance_type = "t3a.2xlarge" 18 | spot_price = "0.10" 19 | tcp_allowed_ingress = [22, 80, 81, 8080, 8888, 9999] 20 | } 21 | 22 | output "public_ip" { 23 | value = module.ec2.public_ip 24 | } 25 | -------------------------------------------------------------------------------- /course/terraform/ec2-spot-instance/.gitignore: -------------------------------------------------------------------------------- 1 | .terraform 2 | *terraform*state* 3 | *lock.hcl -------------------------------------------------------------------------------- /course/terraform/ec2-spot-instance/aws-ec2-instance.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "eu-west-1" 3 | } 4 | 5 | module "vpc" { 6 | source = "./terraform/modules/aws/vpc/vpc" 7 | name = "scratch" 8 | } 9 | 10 | module "ec2" { 11 | source = "../modules/aws/ec2/spot-instance" 12 | name = "scratch" 13 | vpc = module.vpc.vpc_id 14 | subnet = module.vpc.subnet_az1_id 15 | system_user = "rael" 16 | github_user = "raelga" 17 | instance_type = "t3a.2xlarge" 18 | spot_price = "0.10" 19 | tcp_allowed_ingress = [22, 80, 81, 8080, 8888, 9999] 20 | } 21 | 22 | output "public_ip" { 23 | value = module.ec2.public_ip 24 | } 25 | -------------------------------------------------------------------------------- /course/terraform/modules/aws/ec2/ec2-academy-instance/outputs.tf: -------------------------------------------------------------------------------- 1 | output "github_user" { 2 | value = var.github_user 3 | } 4 | 5 | output "system_user" { 6 | value = var.system_user 7 | } 8 | 9 | output "public_ip" { 10 | value = aws_eip.this.public_ip 11 | } 12 | -------------------------------------------------------------------------------- /course/terraform/modules/aws/ec2/ec2-academy-k8s-instance/outputs.tf: -------------------------------------------------------------------------------- 1 | output "github_user" { 2 | value = var.github_user 3 | } 4 | 5 | output "system_user" { 6 | value = var.system_user 7 | } 8 | 9 | output "public_ip" { 10 | value = aws_eip.this.public_ip 11 | } 12 | -------------------------------------------------------------------------------- /course/terraform/modules/aws/ec2/instance/outputs.tf: -------------------------------------------------------------------------------- 1 | output "public_ip" { 2 | value = aws_instance.instance.public_ip 3 | } 4 | -------------------------------------------------------------------------------- /course/terraform/modules/aws/ec2/spot-instance/outputs.tf: -------------------------------------------------------------------------------- 1 | output "public_ip" { 2 | value = aws_spot_instance_request.instance.public_ip 3 | } 4 | -------------------------------------------------------------------------------- /course/terraform/modules/aws/vpc/vpc/outputs.tf: -------------------------------------------------------------------------------- 1 | output "vpc_id" { 2 | value = aws_vpc.main.id 3 | } 4 | output "subnet_az1_id" { 5 | value = aws_subnet.az1.id 6 | } 7 | output "subnet_az2_id" { 8 | value = aws_subnet.az2.id 9 | } 10 | output "subnet_az3_id" { 11 | value = aws_subnet.az3.id 12 | } 13 | -------------------------------------------------------------------------------- /course/terraform/modules/aws/vpc/vpc/variables.tf: -------------------------------------------------------------------------------- 1 | variable "region" { 2 | description = "EC2 region" 3 | type = string 4 | default = "eu-west-1" 5 | } 6 | variable "cidr" { 7 | description = "VPC CIDR" 8 | type = string 9 | default = "10.0.0.0/16" 10 | } 11 | 12 | variable "name" { 13 | description = "VPC name" 14 | type = string 15 | } 16 | 17 | variable "subnet-a" { 18 | description = "Subnet a CIDR" 19 | type = string 20 | default = "10.0.1.0/24" 21 | } 22 | 23 | variable "subnet-b" { 24 | description = "Subnet b CIDR" 25 | type = string 26 | default = "10.0.2.0/24" 27 | } 28 | variable "subnet-c" { 29 | description = "Subnet c CIDR" 30 | type = string 31 | default = "10.0.3.0/24" 32 | } 33 | -------------------------------------------------------------------------------- /k8s-from-scratch/.gitignore: -------------------------------------------------------------------------------- 1 | .terraform 2 | *terraform*state* 3 | *lock.hcl -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/bye-greet.yml: -------------------------------------------------------------------------------- 1 | apiVersion: k8s.rael.io/v1 2 | kind: Greeting 3 | metadata: 4 | name: bye 5 | spec: 6 | greeting: "Bye Cloud Natives" 7 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-manifests/greetings-operator-roleBinding.yaml: -------------------------------------------------------------------------------- 1 | kind: RoleBinding 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | metadata: 4 | name: greeting-operator 5 | subjects: 6 | - kind: ServiceAccount 7 | name: greeting-operator 8 | roleRef: 9 | kind: Role 10 | name: greeting-operator 11 | apiGroup: rbac.authorization.k8s.io 12 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-manifests/greetings-operator-serviceAccount.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: greeting-operator 5 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | services: docker 3 | language: python 4 | install: 5 | - pip install docker molecule openshift 6 | script: 7 | - molecule test -s test-local 8 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/build/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM quay.io/operator-framework/ansible-operator:v0.10.0 2 | 3 | COPY watches.yaml ${HOME}/watches.yaml 4 | 5 | COPY roles/ ${HOME}/roles/ 6 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/build/test-framework/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASEIMAGE 2 | FROM ${BASEIMAGE} 3 | USER 0 4 | 5 | RUN yum install -y python-devel gcc libffi-devel 6 | RUN pip install molecule==2.20.1 7 | 8 | ARG NAMESPACEDMAN 9 | ADD $NAMESPACEDMAN /namespaced.yaml 10 | ADD build/test-framework/ansible-test.sh /ansible-test.sh 11 | RUN chmod +x /ansible-test.sh 12 | USER 1001 13 | ADD . /opt/ansible/project 14 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/build/test-framework/ansible-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export WATCH_NAMESPACE=${TEST_NAMESPACE} 3 | (/usr/local/bin/entrypoint)& 4 | trap "kill $!" SIGINT SIGTERM EXIT 5 | 6 | cd ${HOME}/project 7 | exec molecule test -s test-cluster 8 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/deploy/crds/k8s_v1_greeting_cr.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: k8s.rael.io/v1 2 | kind: Greeting 3 | metadata: 4 | name: example-greeting 5 | spec: 6 | replicas: 3 7 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/deploy/role_binding.yaml: -------------------------------------------------------------------------------- 1 | kind: RoleBinding 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | metadata: 4 | name: greeting-operator 5 | subjects: 6 | - kind: ServiceAccount 7 | name: greeting-operator 8 | roleRef: 9 | kind: Role 10 | name: greeting-operator 11 | apiGroup: rbac.authorization.k8s.io 12 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/deploy/service_account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: greeting-operator 5 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/molecule/default/asserts.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Verify 4 | hosts: localhost 5 | connection: local 6 | vars: 7 | ansible_python_interpreter: '{{ ansible_playbook_python }}' 8 | tasks: 9 | - name: Get all pods in {{ namespace }} 10 | k8s_facts: 11 | api_version: v1 12 | kind: Pod 13 | namespace: '{{ namespace }}' 14 | register: pods 15 | 16 | - name: Output pods 17 | debug: var=pods 18 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/molecule/default/playbook.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Converge 3 | hosts: localhost 4 | connection: local 5 | vars: 6 | ansible_python_interpreter: '{{ ansible_playbook_python }}' 7 | roles: 8 | - greeting 9 | 10 | - import_playbook: '{{ playbook_dir }}/asserts.yml' 11 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/roles/greeting/defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for the greetins operator 3 | replicas: 2 4 | greeting: "Default operator hello" 5 | 6 | # Base settings 7 | service_type: NodePort 8 | nginx_image: nginx:1.17-alpine 9 | echo_image: alpine:3.9 10 | echo_cmd: > 11 | while true; 12 | do 13 | echo "

$GREETING from $HOSTNAME at `date`

" | tee -a /tmp/html/index.html; 14 | sleep 10; 15 | done; -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/roles/greeting/handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # handlers file for greeting 3 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/roles/greeting/vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars file for greeting 3 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/greetings-operator-src/watches.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | - version: v1 3 | group: k8s.rael.io 4 | kind: Greeting 5 | role: /opt/ansible/roles/greeting 6 | reconcilePeriod: 10s 7 | manageStatus: true 8 | -------------------------------------------------------------------------------- /k8s-from-scratch/greetings-crd/hello-greet.yml: -------------------------------------------------------------------------------- 1 | apiVersion: k8s.rael.io/v1 2 | kind: Greeting 3 | metadata: 4 | name: hello 5 | spec: 6 | greeting: "Hello Cloud Natives" 7 | -------------------------------------------------------------------------------- /k8s-from-scratch/hello-manifests/hello-cm.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": "v1", 3 | "kind": "ConfigMap", 4 | "metadata": { 5 | "name": "hello-cm" 6 | }, 7 | "data": { 8 | "GREETING": "Hello folks from kubectl" 9 | } 10 | } -------------------------------------------------------------------------------- /k8s-from-scratch/hello-manifests/hello-svc.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: hello 5 | spec: 6 | type: NodePort 7 | selector: 8 | app: hello 9 | ports: 10 | - port: 80 11 | targetPort: 80 12 | -------------------------------------------------------------------------------- /k8s-from-scratch/kubectl-cfg.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | clusters: 3 | - cluster: 4 | server: localhost:8080 5 | name: localhost 6 | contexts: 7 | - context: 8 | cluster: localhost 9 | user: "" 10 | name: localhost 11 | current-context: localhost 12 | kind: Config 13 | preferences: {} 14 | users: [] -------------------------------------------------------------------------------- /k8s-from-scratch/terraform/.gitignore: -------------------------------------------------------------------------------- 1 | .terraform -------------------------------------------------------------------------------- /k8s-from-scratch/terraform/modules/aws/ec2/instance/outputs.tf: -------------------------------------------------------------------------------- 1 | output "public_ip" { 2 | value = aws_instance.instance.public_ip 3 | } 4 | -------------------------------------------------------------------------------- /k8s-from-scratch/terraform/modules/aws/ec2/spot-instance/outputs.tf: -------------------------------------------------------------------------------- 1 | output "public_ip" { 2 | value = aws_spot_instance_request.instance.public_ip 3 | } 4 | -------------------------------------------------------------------------------- /k8s-from-scratch/terraform/modules/aws/vpc/vpc/outputs.tf: -------------------------------------------------------------------------------- 1 | output "vpc_id" { 2 | value = aws_vpc.main.id 3 | } 4 | output "subnet_az1_id" { 5 | value = aws_subnet.az1.id 6 | } 7 | output "subnet_az2_id" { 8 | value = aws_subnet.az2.id 9 | } 10 | output "subnet_az3_id" { 11 | value = aws_subnet.az3.id 12 | } 13 | -------------------------------------------------------------------------------- /k8s-from-scratch/terraform/modules/aws/vpc/vpc/variables.tf: -------------------------------------------------------------------------------- 1 | variable "region" { 2 | description = "EC2 region" 3 | type = string 4 | default = "eu-west-1" 5 | } 6 | variable "cidr" { 7 | description = "VPC CIDR" 8 | type = string 9 | default = "10.0.0.0/16" 10 | } 11 | 12 | variable "name" { 13 | description = "VPC name" 14 | type = string 15 | } 16 | 17 | variable "subnet-a" { 18 | description = "Subnet a CIDR" 19 | type = string 20 | default = "10.0.1.0/24" 21 | } 22 | 23 | variable "subnet-b" { 24 | description = "Subnet b CIDR" 25 | type = string 26 | default = "10.0.2.0/24" 27 | } 28 | variable "subnet-c" { 29 | description = "Subnet c CIDR" 30 | type = string 31 | default = "10.0.3.0/24" 32 | } 33 | -------------------------------------------------------------------------------- /k8s-from-scratch/terraform/resources/aws-ec2/main.tf: -------------------------------------------------------------------------------- 1 | 2 | data "terraform_remote_state" "aws_network" { 3 | backend = "s3" 4 | config = { 5 | region = "eu-west-1" 6 | key = "aws-network" 7 | bucket = "tf-state-talks" 8 | dynamodb_table = "tf-state-talks-locks" 9 | } 10 | } 11 | 12 | module "ec2" { 13 | source = "../../modules/aws/ec2/spot-instance" 14 | name = "sandbox" 15 | vpc = "${data.terraform_remote_state.aws_network.outputs.vpc_id}" 16 | subnet = "${data.terraform_remote_state.aws_network.outputs.subnet_az1_id}" 17 | system_user = "rael" 18 | github_user = "raelga" 19 | instance_type = "t3a.2xlarge" 20 | spot_price = "0.10" 21 | tcp_allowed_ingress = [ 22, 80, 443 ] 22 | } 23 | -------------------------------------------------------------------------------- /k8s-from-scratch/terraform/resources/aws-ec2/outputs.tf: -------------------------------------------------------------------------------- 1 | output "public_ip" { 2 | value = "${module.ec2.public_ip}" 3 | } 4 | -------------------------------------------------------------------------------- /k8s-from-scratch/terraform/resources/aws-ec2/provider.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "eu-west-1" 3 | profile = "terraform" 4 | } 5 | 6 | terraform { 7 | backend "s3" { 8 | region = "eu-west-1" 9 | key = "aws-ec2" 10 | bucket = "tf-state-talks" 11 | dynamodb_table = "tf-state-talks-locks" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /k8s-from-scratch/terraform/resources/aws-network/main.tf: -------------------------------------------------------------------------------- 1 | module "vpc" { 2 | source = "../../modules/aws/vpc/vpc" 3 | name = "base" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /k8s-from-scratch/terraform/resources/aws-network/outputs.tf: -------------------------------------------------------------------------------- 1 | output "vpc_id" { 2 | value = "${module.vpc.vpc_id}" 3 | } 4 | 5 | output "subnet_az1_id" { 6 | value = "${module.vpc.subnet_az1_id}" 7 | } 8 | output "subnet_az2_id" { 9 | value = "${module.vpc.subnet_az2_id}" 10 | } 11 | output "subnet_az3_id" { 12 | value = "${module.vpc.subnet_az3_id}" 13 | } -------------------------------------------------------------------------------- /k8s-from-scratch/terraform/resources/aws-network/provider.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "eu-west-1" 3 | profile = "terraform" 4 | } 5 | 6 | terraform { 7 | backend "s3" { 8 | region = "eu-west-1" 9 | key = "aws-network" 10 | bucket = "tf-state-talks" 11 | dynamodb_table = "tf-state-talks-locks" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /kubecon/kubecap2019/yamls/Cluster-MachineDeployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: "cluster.k8s.io/v1alpha1" 2 | kind: MachineDeployment 3 | metadata: 4 | name: my-first-machine-deployment 5 | spec: 6 | replias: 3 7 | template: 8 | ... 9 | strategy: 10 | type: RollingUpdate 11 | rollingUpdate: 12 | maxUnavailable: 0 13 | maxSurge: 1 -------------------------------------------------------------------------------- /kubecon/kubecap2019/yamls/kind-stable-1-3.yaml: -------------------------------------------------------------------------------- 1 | # a cluster with 2 control-plane nodes and 3 workers 2 | kind: Cluster 3 | apiVersion: kind.sigs.k8s.io/v1alpha3 4 | nodes: 5 | - role: control-plane 6 | - role: worker 7 | - role: worker 8 | - role: worker -------------------------------------------------------------------------------- /kubecon/kubecap2019/yamls/kind/201_simple-rs-5.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: simple 5 | spec: 6 | replicas: 5 7 | selector: 8 | matchLabels: 9 | app: simple 10 | template: 11 | metadata: 12 | labels: 13 | app: simple 14 | spec: 15 | containers: 16 | - name: app 17 | image: raelga/cats:gatet 18 | resources: 19 | requests: 20 | cpu: "100m" 21 | memory: "50Mi" 22 | limits: 23 | cpu: "1" 24 | memory: "100Mi" -------------------------------------------------------------------------------- /kubecon/kubecap2019/yamls/kind/hello-sh.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: hello-sh 6 | labels: 7 | app: hello-sh 8 | tier: demo 9 | spec: 10 | containers: 11 | - name: hello-sh 12 | image: busybox 13 | command: ['sh', '-c', 'echo Hello Kubernetes from $(hostname)! && sleep 30'] 14 | -------------------------------------------------------------------------------- /kubecon/kubecap2019/yamls/kind/kind-stable-1-3.yaml: -------------------------------------------------------------------------------- 1 | # a cluster with 2 control-plane nodes and 3 workers 2 | kind: Cluster 3 | apiVersion: kind.sigs.k8s.io/v1alpha3 4 | nodes: 5 | - role: control-plane 6 | - role: worker 7 | - role: worker 8 | - role: worker -------------------------------------------------------------------------------- /kubecon/kubecap2019/yamls/smi-traffic-access-control.yaml: -------------------------------------------------------------------------------- 1 | kind: TrafficTarget 2 | apiVersion: access.smi-spec.io/v1alpha1 3 | metadata: 4 | name: path-specific 5 | namespace: default 6 | destination: 7 | kind: ServiceAccount 8 | name: service-a 9 | namespace: default 10 | port: 8080 11 | specs: 12 | - kind: HTTPRouteGroup 13 | name: the-routes 14 | matches: 15 | - metrics 16 | sources: 17 | - kind: ServiceAccount 18 | name: prometheus 19 | namespace: default -------------------------------------------------------------------------------- /kubecon/kubecap2019/yamls/smi-traffic-metrics.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: metrics.smi-spec.io/v1alpha1 2 | kind: TrafficMetrics 3 | # See ObjectReference v1 core for full spec 4 | resource: 5 | name: foo-775b9cbd88-ntxsl 6 | namespace: foobar 7 | kind: Pod 8 | edge: 9 | direction: to 10 | resource: 11 | name: baz-577db7d977-lsk2q 12 | namespace: foobar 13 | kind: Pod 14 | window: 30s 15 | metrics: 16 | - name: p99_response_latency 17 | unit: seconds 18 | value: 10m 19 | - name: p90_response_latency 20 | unit: seconds 21 | value: 10m 22 | - name: p50_response_latency 23 | unit: seconds 24 | value: 10m 25 | - name: success_count 26 | value: 100 27 | - name: failure_count 28 | value: 100 -------------------------------------------------------------------------------- /kubecon/kubecap2019/yamls/smi-traffic-spec-http.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: specs.smi-spec.io/v1alpha1 2 | kind: HTTPRouteGroup 3 | metadata: 4 | name: the-routes 5 | matches: 6 | - name: metrics 7 | pathRegex: "/metrics" 8 | methods: 9 | - GET 10 | - name: health 11 | pathRegex: "/ping" 12 | methods: ["*"] -------------------------------------------------------------------------------- /kubecon/kubecap2019/yamls/smi-traffic-split.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: split.smi-spec.io/v1alpha1 2 | kind: TrafficSplit 3 | metadata: 4 | name: my-weights 5 | spec: 6 | # The root service that clients use to connect to the destination application. 7 | service: numbers 8 | # Services inside the namespace with their own selectors, endpoints and configuration. 9 | backends: 10 | - service: one 11 | # Identical to resources, 1 = 1000m 12 | weight: 10m 13 | - service: two 14 | weight: 100m 15 | - service: three 16 | weight: 1500m -------------------------------------------------------------------------------- /kubecon/kubecap2019/yamls/travis.yaml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | language: go 3 | go: 4 | - "1.12" 5 | 6 | services: 7 | - docker 8 | 9 | install: true 10 | 11 | script: 12 | - echo "Run your tests here" 13 | 14 | before_install: 15 | # Download and install Kind and kubectl 16 | - GO111MODULE=on go get sigs.k8s.io/kind 17 | - kind create cluster --config kind-config.yaml 18 | - export KUBECONFIG="$(kind get kubeconfig-path --name="kind")" 19 | - curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.14.3/bin/linux/amd64/kubectl 20 | - chmod +x ./kubectl 21 | - ./kubectl get nodes -o wide 22 | - ./kubectl get pods --all-namespaces -o wide 23 | - ./kubectl get services --all-namespaces -o wide -------------------------------------------------------------------------------- /providers/aws/eks/iam/AmazonEKSServiceRole.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2012-10-17", 3 | "Statement": [ 4 | { 5 | "Effect": "Allow", 6 | "Principal": { 7 | "Service": "eks.amazonaws.com" 8 | }, 9 | "Action": "sts:AssumeRole" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /providers/aws/eks/manifests/eks-admin-binding-role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1beta1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: eks-admin 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: cluster-admin 9 | subjects: 10 | - kind: ServiceAccount 11 | name: eks-admin 12 | namespace: kube-system -------------------------------------------------------------------------------- /providers/aws/eks/manifests/eks-admin-service-account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: eks-admin 5 | namespace: kube-system -------------------------------------------------------------------------------- /providers/aws/eks/manifests/eks-kubeconfig.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | clusters: 3 | - cluster: 4 | server: 5 | certificate-authority-data: 6 | name: 7 | contexts: 8 | - context: 9 | cluster: 10 | user: k8s 11 | name: 12 | kind: Config 13 | preferences: {} 14 | users: 15 | - name: k8s 16 | user: 17 | exec: 18 | apiVersion: client.authentication.k8s.io/v1alpha1 19 | command: heptio-authenticator-aws 20 | args: 21 | - "token" 22 | - "-i" 23 | - "" -------------------------------------------------------------------------------- /providers/aws/eks/manifests/k8s-aws-auth-cm.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: aws-auth 5 | namespace: kube-system 6 | data: 7 | mapRoles: | 8 | - rolearn: 9 | username: system:node:{{EC2PrivateDNSName}} 10 | groups: 11 | - system:bootstrappers 12 | - system:nodes 13 | -------------------------------------------------------------------------------- /providers/aws/eks/manifests/manifests/eks-admin-binding-role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1beta1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: eks-admin 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: cluster-admin 9 | subjects: 10 | - kind: ServiceAccount 11 | name: eks-admin 12 | namespace: kube-system -------------------------------------------------------------------------------- /providers/aws/eks/manifests/manifests/eks-admin-service-account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: eks-admin 5 | namespace: kube-system -------------------------------------------------------------------------------- /providers/aws/eks/manifests/manifests/eks-kubeconfig.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | clusters: 3 | - cluster: 4 | server: 5 | certificate-authority-data: 6 | name: 7 | contexts: 8 | - context: 9 | cluster: 10 | user: k8s 11 | name: .talks.aws.rael.io 12 | kind: Config 13 | preferences: {} 14 | users: 15 | - name: k8s 16 | user: 17 | exec: 18 | apiVersion: client.authentication.k8s.io/v1alpha1 19 | command: heptio-authenticator-aws 20 | args: 21 | - "token" 22 | - "-i" 23 | - "" 24 | env: 25 | - name: AWS_PROFILE 26 | value: "k8s-talks" -------------------------------------------------------------------------------- /providers/aws/eks/manifests/manifests/k8s-aws-auth-cm.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: aws-auth 5 | namespace: kube-system 6 | data: 7 | mapRoles: | 8 | - rolearn: 9 | username: system:node:{{EC2PrivateDNSName}} 10 | groups: 11 | - system:bootstrappers 12 | - system:nodes 13 | -------------------------------------------------------------------------------- /providers/aws/eks/route53/CustomRoute53RecordSet.json: -------------------------------------------------------------------------------- 1 | { 2 | "Comment": "Update record to reflect new cluster endpoint", 3 | "Changes": [ 4 | { 5 | "Action": "UPSERT", 6 | "ResourceRecordSet": { 7 | "Name": "api.eks.talks.aws.rael.io.", 8 | "Type": "CNAME", 9 | "TTL": 300, 10 | "ResourceRecords": [ 11 | { 12 | "Value": "" 13 | } 14 | ] 15 | } 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /providers/do/images/README.md: -------------------------------------------------------------------------------- 1 | # Credits 2 | 3 | All images from this folder are from https://www.digitalocean.com/ 4 | 5 | - https://www.digitalocean.com/products/ 6 | - https://www.digitalocean.com/docs/ -------------------------------------------------------------------------------- /providers/do/images/do-community.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-community.png -------------------------------------------------------------------------------- /providers/do/images/do-credit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-credit.gif -------------------------------------------------------------------------------- /providers/do/images/do-developers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-developers.png -------------------------------------------------------------------------------- /providers/do/images/do-droplets-sizes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-droplets-sizes.png -------------------------------------------------------------------------------- /providers/do/images/do-logo-sammy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-logo-sammy.png -------------------------------------------------------------------------------- /providers/do/images/do-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-logo.png -------------------------------------------------------------------------------- /providers/do/images/do-main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-main.png -------------------------------------------------------------------------------- /providers/do/images/do-managed-databases.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-managed-databases.png -------------------------------------------------------------------------------- /providers/do/images/do-managed-kubernetes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-managed-kubernetes.png -------------------------------------------------------------------------------- /providers/do/images/do-marketplace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-marketplace.png -------------------------------------------------------------------------------- /providers/do/images/do-private-networks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-private-networks.png -------------------------------------------------------------------------------- /providers/do/images/do-sammy-404.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-sammy-404.gif -------------------------------------------------------------------------------- /providers/do/images/do-sammy-load.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-sammy-load.gif -------------------------------------------------------------------------------- /providers/do/images/do-sammy-space.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/providers/do/images/do-sammy-space.png -------------------------------------------------------------------------------- /providers/do/labs/do/.gitignore: -------------------------------------------------------------------------------- 1 | .kube 2 | .terraform 3 | *.tfstate 4 | *.tfstate.backup 5 | -------------------------------------------------------------------------------- /providers/do/labs/do/json/k8s-1.13-cluster.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "barcelonacloud-k8s-1-13", 3 | "region": "fra1", 4 | "version": "1.13.4-do.0", 5 | "node_pools": [ 6 | { 7 | "name": "barcelonacloud-k8s-1-13-np", 8 | "size": "s-2vcpu-2gb", 9 | "count": 1 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /providers/do/labs/k8s/.gitignore: -------------------------------------------------------------------------------- 1 | wip 2 | -------------------------------------------------------------------------------- /providers/do/labs/k8s/Makefile: -------------------------------------------------------------------------------- 1 | k8s-get-admin-user-token: 2 | kubectl get -n kube-system -o json secrets \ 3 | | jq -r '.items[] | select (.metadata.annotations."kubernetes.io/service-account.name"=="admin-user") | .data.token' \ 4 | | base64 -d -------------------------------------------------------------------------------- /providers/do/labs/k8s/default/kslides-deployment.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | kind: Deployment 4 | apiVersion: extensions/v1beta1 5 | metadata: 6 | name: kslides 7 | labels: 8 | app: kslides 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: kslides 14 | template: 15 | metadata: 16 | labels: 17 | app: kslides 18 | version: v0.0.1 19 | spec: 20 | containers: 21 | - name: cat 22 | image: raelga/kslides:latest 23 | ports: 24 | - name: present 25 | containerPort: 3999 26 | resources: 27 | requests: 28 | cpu: 20m 29 | memory: 32M 30 | limits: 31 | cpu: 100m 32 | memory: 64M 33 | -------------------------------------------------------------------------------- /providers/do/labs/k8s/default/kslides-service-lb.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: kslides-lb 6 | spec: 7 | type: LoadBalancer 8 | ports: 9 | - name: present 10 | targetPort: present 11 | port: 80 12 | selector: 13 | app: kslides -------------------------------------------------------------------------------- /providers/do/labs/k8s/kube-system/admin-user.yaml: -------------------------------------------------------------------------------- 1 | # ------------------- admin-user service account ------------------- # 2 | 3 | apiVersion: v1 4 | kind: ServiceAccount 5 | metadata: 6 | name: admin-user 7 | namespace: kube-system 8 | 9 | --- 10 | 11 | # ------------------- admin-user cluster role binding ------------------- # 12 | 13 | apiVersion: rbac.authorization.k8s.io/v1 14 | kind: ClusterRoleBinding 15 | metadata: 16 | name: admin-user 17 | roleRef: 18 | apiGroup: rbac.authorization.k8s.io 19 | kind: ClusterRole 20 | name: cluster-admin 21 | subjects: 22 | - kind: ServiceAccount 23 | name: admin-user 24 | namespace: kube-system 25 | 26 | --- 27 | 28 | # kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') 29 | -------------------------------------------------------------------------------- /providers/do/labs/k8s/kube-system/kubernetes-dashboard-ingressRoute.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: traefik.containo.us/v1alpha1 2 | kind: IngressRoute 3 | metadata: 4 | name: kubernetes-dashboard.crd 5 | 6 | spec: 7 | entrypoints: 8 | - web 9 | routes: 10 | - match: Host(`dashboard.do.rael.io`) 11 | kind: Rule 12 | priority: 12 13 | services: 14 | - name: kubernetes-dashboard 15 | port: 80 -------------------------------------------------------------------------------- /study-jams/cloud/do/.gitignore: -------------------------------------------------------------------------------- 1 | .kube 2 | .terraform 3 | *.tfstate 4 | *.tfstate.backup 5 | -------------------------------------------------------------------------------- /study-jams/cloud/do/json/cnbcn-k8s-study-jam-cluster.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cnbcn-k8s-study-jam", 3 | "region": "fra1", 4 | "version": "1.13.4-do.0", 5 | "node_pools": [ 6 | { 7 | "name": "cnbcn-k8s-study-jam-np", 8 | "size": "s-2vcpu-2gb", 9 | "count": 2 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /study-jams/docker/raelga/toolbox/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | RUN apk update \ 3 | && apk add curl bind-tools jq coreutils bash \ 4 | && rm -rf /var/cache/apk/* 5 | 6 | CMD [ "/bin/bash" ] 7 | -------------------------------------------------------------------------------- /study-jams/k8s/.gitignore: -------------------------------------------------------------------------------- 1 | wip 2 | -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/boombox.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: boom 6 | labels: 7 | app: boom 8 | spec: 9 | containers: 10 | - name: toolbox 11 | image: raelga/toolbox 12 | command: [ 'bash', '-c', 'sleep 3600' ] -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/busybox-0.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-0 6 | labels: 7 | app: busybox 8 | id: "0" 9 | spec: 10 | containers: 11 | - name: busybox 12 | image: busybox 13 | command: ['sh', '-c', 'sleep 321'] 14 | -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/busybox-probes-readiness-ko.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: busybox-probes-readiness-ko 5 | spec: 6 | containers: 7 | - name: busybox 8 | image: busybox 9 | args: 10 | - /bin/sh 11 | - -c 12 | - echo 'Hi!'; sleep 20; echo 'Healthy!'; touch /tmp/healthy; sleep 10; rm -vrf /tmp/healthy; sleep 3600; 13 | readinessProbe: 14 | exec: 15 | command: 16 | - cat 17 | - /tmp/healthy 18 | initialDelaySeconds: 15 19 | periodSeconds: 1 -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/busybox-probes-readiness-ok.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: busybox-probes-readiness-ok 5 | spec: 6 | containers: 7 | - name: busybox 8 | image: busybox 9 | args: 10 | - /bin/sh 11 | - -c 12 | - echo 'Hi!'; sleep 10; echo 'Healthy!'; touch /tmp/healthy; sleep 10; rm -vrf /tmp/healthy; sleep 3600; 13 | readinessProbe: 14 | exec: 15 | command: 16 | - cat 17 | - /tmp/healthy 18 | initialDelaySeconds: 1 19 | periodSeconds: 5 -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/busybox-resources-0.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-resources-0 6 | labels: 7 | app: busybox 8 | resources: both 9 | id: "0" 10 | spec: 11 | containers: 12 | - name: busybox 13 | image: busybox 14 | command: ['sh', '-c', 'sleep 321'] 15 | resources: 16 | requests: 17 | cpu: "25m" 18 | memory: "512Mi" 19 | limits: 20 | cpu: "1" 21 | memory: "1024Mi" -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/busybox-resources-limits.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-resources-limits 6 | labels: 7 | app: busybox 8 | resources: limits 9 | spec: 10 | containers: 11 | - name: busybox 12 | image: busybox 13 | command: ['sh', '-c', 'sleep 321'] 14 | resources: 15 | limits: 16 | cpu: "100m" 17 | memory: "100Mi" -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/busybox-resources-requests-unschedulable.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-resources-requests-unschedulable 6 | labels: 7 | app: busybox 8 | resources: unschedulable 9 | spec: 10 | containers: 11 | - name: busybox 12 | image: busybox 13 | command: ['sh', '-c', 'sleep 321'] 14 | resources: 15 | requests: 16 | cpu: "4" 17 | memory: "1000Mi" -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/busybox-resources-requests.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-resources-requests-0 6 | labels: 7 | app: busybox 8 | resources: requests 9 | id: "0" 10 | spec: 11 | containers: 12 | - name: busybox 13 | image: busybox 14 | command: ['sh', '-c', 'sleep 321'] 15 | resources: 16 | requests: 17 | cpu: "25m" 18 | memory: "256Mi" 19 | limits: 20 | cpu: "1" 21 | memory: "512Mi" -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/busybox-resources.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: busybox-resources-both 6 | labels: 7 | app: busybox 8 | resources: both 9 | spec: 10 | containers: 11 | - name: busybox 12 | image: busybox 13 | command: ['sh', '-c', 'sleep 321'] 14 | resources: 15 | requests: 16 | cpu: "100m" 17 | memory: "100Mi" 18 | limits: 19 | cpu: "100m" 20 | memory: "100Mi" -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/hello-sh-updated.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: hello-sh 6 | labels: 7 | app: hello-sh 8 | spec: 9 | containers: 10 | - name: hello-sh 11 | image: busybox 12 | command: ['sh', '-c', 'echo Hello Kubernetes from $(hostname)! && sleep 3600'] 13 | -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/hello-sh.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: hello-sh 6 | labels: 7 | app: hello-sh 8 | tier: demo 9 | spec: 10 | containers: 11 | - name: hello-sh 12 | image: busybox 13 | command: ['sh', '-c', 'echo Hello Kubernetes from $(hostname)! && sleep 30'] 14 | -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/nginx-and-shell-network.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: nginx-and-shell-network 6 | labels: 7 | app: nginx 8 | tier: frontend 9 | spec: 10 | containers: 11 | - name: nginx 12 | image: nginx:1.15.11-alpine 13 | ports: 14 | - containerPort: 80 15 | resources: 16 | requests: 17 | cpu: "100m" 18 | memory: "100Mi" 19 | limits: 20 | cpu: "100m" 21 | memory: "100Mi" 22 | - name: shell 23 | image: raelga/toolbox 24 | command: ['bash', '-c', 'sleep 3600'] 25 | resources: 26 | requests: 27 | cpu: "100m" 28 | memory: "100Mi" 29 | limits: 30 | cpu: "100m" 31 | memory: "100Mi" 32 | -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/nginx.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: nginx 6 | labels: 7 | app: nginx 8 | tier: frontend 9 | namespace: kube-system 10 | spec: 11 | containers: 12 | - name: nginx 13 | image: nginx:1.15.11-alpine 14 | resources: 15 | requests: 16 | cpu: "100m" 17 | memory: "100Mi" 18 | limits: 19 | cpu: "100m" 20 | memory: "100Mi" -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/basics/shell.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: shell 6 | labels: 7 | app: shell 8 | spec: 9 | containers: 10 | - name: shell 11 | image: raelga/toolbox 12 | command: ['bash', '-c', 'sleep 3600'] -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/init-containers/busybox-init-containers-dummy-svc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: dummy-svc 6 | spec: 7 | ports: 8 | - protocol: TCP 9 | port: 80 10 | targetPort: 1234 -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/init-containers/busybox-init-containers.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: busybox-init-containers 5 | spec: 6 | containers: 7 | - name: busybox 8 | image: busybox 9 | args: 10 | - /bin/sh 11 | - -c 12 | - echo The app is running! && sleep 15 && touch /tmp/healthy && sleep 3600 13 | readinessProbe: 14 | exec: 15 | command: 16 | - cat 17 | - /tmp/healthy 18 | initialDelaySeconds: 15 19 | periodSeconds: 1 20 | initContainers: 21 | - name: init-dummy-svc-wait 22 | image: bash 23 | command: 24 | - sh 25 | - -c 26 | - until nslookup dummy-svc; do echo waiting for dummy-svc; sleep 2; done; 27 | - name: init-gcloud-sdk 28 | image: google/cloud-sdk:245.0.0-alpine -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/lifecycle/busybox-probes-readiness-ko.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: busybox-probes-readiness-ko 5 | spec: 6 | containers: 7 | - name: busybox 8 | image: busybox 9 | args: 10 | - /bin/sh 11 | - -c 12 | - echo 'Hi!'; sleep 20; echo 'Healthy!'; touch /tmp/healthy; sleep 10; rm -vrf /tmp/healthy; sleep 3600; 13 | readinessProbe: 14 | exec: 15 | command: 16 | - cat 17 | - /tmp/healthy 18 | initialDelaySeconds: 15 19 | periodSeconds: 1 -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/lifecycle/busybox-probes-readiness-ok.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Pod 3 | metadata: 4 | name: busybox-probes-readiness-ok 5 | spec: 6 | containers: 7 | - name: busybox 8 | image: busybox 9 | args: 10 | - /bin/sh 11 | - -c 12 | - echo 'Hi!'; sleep 10; echo 'Healthy!'; touch /tmp/healthy; sleep 10; rm -vrf /tmp/healthy; sleep 3600; 13 | readinessProbe: 14 | exec: 15 | command: 16 | - cat 17 | - /tmp/healthy 18 | initialDelaySeconds: 1 19 | periodSeconds: 5 -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/lifecycle/nginx-probes-liveness.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: nginx 6 | labels: 7 | app: nginx 8 | tier: frontend 9 | namespace: kube-system 10 | spec: 11 | containers: 12 | - name: nginx 13 | image: nginx:1.15.11-alpine 14 | readinessProbe: 15 | -------------------------------------------------------------------------------- /study-jams/k8s/default/pods/lifecycle/nginx-probes-readiness.yml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: nginx 6 | labels: 7 | app: nginx 8 | tier: frontend 9 | namespace: kube-system 10 | spec: 11 | containers: 12 | - name: nginx 13 | image: nginx:1.15.11-alpine 14 | resources: 15 | requests: 16 | cpu: "100m" 17 | memory: "100Mi" 18 | limits: 19 | cpu: "100m" 20 | memory: "100Mi" -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/101_simple-rs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: simple 5 | spec: 6 | replicas: 1 7 | selector: 8 | matchLabels: 9 | app: simple 10 | template: 11 | metadata: 12 | labels: 13 | app: simple 14 | spec: 15 | containers: 16 | - name: app 17 | image: raelga/cats:gatet -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/201_simple-rs-5.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: simple 5 | spec: 6 | replicas: 5 7 | selector: 8 | matchLabels: 9 | app: simple 10 | template: 11 | metadata: 12 | labels: 13 | app: simple 14 | spec: 15 | containers: 16 | - name: app 17 | image: raelga/cats:gatet 18 | resources: 19 | requests: 20 | cpu: "100m" 21 | memory: "50Mi" 22 | limits: 23 | cpu: "1" 24 | memory: "100Mi" -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/202_simple-rs-50.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: simple 5 | spec: 6 | replicas: 50 7 | selector: 8 | matchLabels: 9 | app: simple 10 | template: 11 | metadata: 12 | labels: 13 | app: simple 14 | spec: 15 | containers: 16 | - name: app 17 | image: raelga/cats:gatet 18 | resources: 19 | requests: 20 | cpu: "100m" 21 | memory: "50Mi" 22 | limits: 23 | cpu: "1" 24 | memory: "100Mi" -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/301_simple-blue-pods.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: simple-blue-pod-1 6 | labels: 7 | app: simple 8 | color: blue 9 | spec: 10 | containers: 11 | - name: app 12 | image: raelga/cats:liam 13 | --- 14 | apiVersion: v1 15 | kind: Pod 16 | metadata: 17 | name: simple-blue-pod-2 18 | labels: 19 | app: simple 20 | color: blue 21 | spec: 22 | containers: 23 | - name: app 24 | image: raelga/cats:liam 25 | --- 26 | apiVersion: v1 27 | kind: Pod 28 | metadata: 29 | name: simple-blue-pod-3 30 | labels: 31 | app: simple 32 | color: blue 33 | spec: 34 | containers: 35 | - name: app 36 | image: raelga/cats:liam -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/302_simple-blue-rs.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: ReplicaSet 4 | metadata: 5 | name: simple-blue 6 | spec: 7 | replicas: 5 8 | selector: 9 | matchLabels: 10 | app: simple 11 | color: blue 12 | template: 13 | metadata: 14 | labels: 15 | app: simple 16 | color: blue 17 | spec: 18 | containers: 19 | - name: app 20 | image: raelga/cats:liam 21 | -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/303_simple-red-pods.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: simple-red-pod-1 6 | labels: 7 | app: simple 8 | color: red 9 | spec: 10 | containers: 11 | - name: app 12 | image: raelga/cats:liam -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/304_simple-rs-nocolor-update.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: ReplicaSet 4 | metadata: 5 | name: simple 6 | spec: 7 | replicas: 1 8 | selector: 9 | matchLabels: 10 | app: simple 11 | matchExpressions: 12 | - { key: color, operator: DoesNotExist } 13 | template: 14 | metadata: 15 | labels: 16 | app: simple 17 | spec: 18 | containers: 19 | - name: app 20 | image: raelga/cats:gatet -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/305_simple-nocolor-rs.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: ReplicaSet 4 | metadata: 5 | name: simple-nocolor 6 | labels: 7 | app: simple 8 | spec: 9 | replicas: 5 10 | selector: 11 | matchLabels: 12 | app: simple 13 | matchExpressions: 14 | - { key: color, operator: DoesNotExist } 15 | template: 16 | metadata: 17 | labels: 18 | app: simple 19 | spec: 20 | containers: 21 | - name: app 22 | image: raelga/cats:gatet 23 | -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/306_simple-orange-pods.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Pod 4 | metadata: 5 | name: simple-orange-pod-1 6 | labels: 7 | app: simple 8 | color: orange 9 | spec: 10 | containers: 11 | - name: app 12 | image: raelga/cats:lia 13 | --- 14 | apiVersion: v1 15 | kind: Pod 16 | metadata: 17 | name: simple-orange-pod-2 18 | labels: 19 | app: simple 20 | color: orange 21 | spec: 22 | containers: 23 | - name: app 24 | image: raelga/cats:lia 25 | --- 26 | apiVersion: v1 27 | kind: Pod 28 | metadata: 29 | name: simple-orange-pod-3 30 | labels: 31 | app: simple 32 | color: orange 33 | spec: 34 | containers: 35 | - name: app 36 | image: raelga/cats:lia -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/307_simple-orange-rs.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: ReplicaSet 4 | metadata: 5 | name: simple-orange 6 | spec: 7 | replicas: 6 8 | selector: 9 | matchLabels: 10 | app: simple 11 | color: orange 12 | template: 13 | metadata: 14 | labels: 15 | app: simple 16 | color: orange 17 | spec: 18 | containers: 19 | - name: app 20 | image: raelga/cats:lia 21 | -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/400_probes-rs-readiness.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes 5 | labels: 6 | app: probes 7 | spec: 8 | replicas: 2 9 | selector: 10 | matchLabels: 11 | app: probes 12 | template: 13 | metadata: 14 | labels: 15 | app: probes 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:neu 20 | readinessProbe: 21 | tcpSocket: 22 | port: 80 23 | initialDelaySeconds: 10 24 | periodSeconds: 5 25 | successThreshold: 3 26 | -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/401_probes-rs-readiness-ko.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes 5 | labels: 6 | app: probes 7 | spec: 8 | replicas: 4 9 | selector: 10 | matchLabels: 11 | app: probes 12 | template: 13 | metadata: 14 | labels: 15 | app: probes 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:neu 20 | readinessProbe: 21 | tcpSocket: 22 | port: 81 23 | initialDelaySeconds: 10 24 | periodSeconds: 5 25 | successThreshold: 3 26 | -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/402_probes-rs-liveness.yaml: -------------------------------------------------------------------------------- 1 | 2 | apiVersion: apps/v1 3 | kind: ReplicaSet 4 | metadata: 5 | name: probes 6 | labels: 7 | app: probes 8 | spec: 9 | replicas: 6 10 | selector: 11 | matchLabels: 12 | app: probes 13 | template: 14 | metadata: 15 | labels: 16 | app: probes 17 | spec: 18 | containers: 19 | - name: app 20 | image: raelga/cats:neu 21 | livenessProbe: 22 | httpGet: 23 | path: / 24 | port: 80 25 | initialDelaySeconds: 10 26 | periodSeconds: 5 27 | failureThreshold: 2 -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/403_probes-rs-liveness-ko.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes 5 | labels: 6 | app: probes 7 | spec: 8 | replicas: 8 9 | selector: 10 | matchLabels: 11 | app: probes 12 | template: 13 | metadata: 14 | labels: 15 | app: probes 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:neu 20 | readinessProbe: 21 | tcpSocket: 22 | port: 80 23 | initialDelaySeconds: 10 24 | periodSeconds: 5 25 | successThreshold: 3 26 | livenessProbe: 27 | httpGet: 28 | path: /bad-endpoint 29 | port: 80 30 | initialDelaySeconds: 10 31 | periodSeconds: 5 32 | failureThreshold: 2 -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/501_probes-images-rs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes-images 5 | labels: 6 | app: probes-images 7 | spec: 8 | replicas: 3 9 | selector: 10 | matchLabels: 11 | app: probes-images 12 | template: 13 | metadata: 14 | labels: 15 | app: probes-images 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:neu 20 | readinessProbe: 21 | httpGet: 22 | path: / 23 | port: 80 24 | initialDelaySeconds: 2 25 | livenessProbe: 26 | httpGet: 27 | path: / 28 | port: 80 29 | initialDelaySeconds: 10 30 | periodSeconds: 5 31 | failureThreshold: 2 -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/502_probes-images-rs-update-image-ko.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes-images 5 | labels: 6 | app: probes-images 7 | spec: 8 | replicas: 3 9 | selector: 10 | matchLabels: 11 | app: probes-images 12 | template: 13 | metadata: 14 | labels: 15 | app: probes-images 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:blanca 20 | readinessProbe: 21 | httpGet: 22 | path: /bad-endpoint 23 | port: 80 24 | initialDelaySeconds: 2 25 | livenessProbe: 26 | httpGet: 27 | path: / 28 | port: 80 29 | initialDelaySeconds: 10 30 | periodSeconds: 5 31 | failureThreshold: 2 -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/503_probes-images-rs-6-update-image-ko.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes-images 5 | labels: 6 | app: probes-images 7 | spec: 8 | replicas: 6 9 | selector: 10 | matchLabels: 11 | app: probes-images 12 | template: 13 | metadata: 14 | labels: 15 | app: probes-images 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:blanca 20 | readinessProbe: 21 | httpGet: 22 | path: /bad-endpoint 23 | port: 80 24 | initialDelaySeconds: 2 25 | livenessProbe: 26 | httpGet: 27 | path: / 28 | port: 80 29 | initialDelaySeconds: 10 30 | periodSeconds: 5 31 | failureThreshold: 2 -------------------------------------------------------------------------------- /study-jams/k8s/default/replicasets/504_probes-images-rs-9-update-image-ok.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: ReplicaSet 3 | metadata: 4 | name: probes-images 5 | labels: 6 | app: probes-images 7 | spec: 8 | replicas: 9 9 | selector: 10 | matchLabels: 11 | app: probes-images 12 | template: 13 | metadata: 14 | labels: 15 | app: probes-images 16 | spec: 17 | containers: 18 | - name: app 19 | image: raelga/cats:blanca 20 | readinessProbe: 21 | httpGet: 22 | path: / 23 | port: 80 24 | initialDelaySeconds: 2 25 | livenessProbe: 26 | httpGet: 27 | path: / 28 | port: 80 29 | initialDelaySeconds: 10 30 | periodSeconds: 5 31 | failureThreshold: 2 -------------------------------------------------------------------------------- /study-jams/k8s/kube-system/admin-user.yaml: -------------------------------------------------------------------------------- 1 | # ------------------- admin-user service account ------------------- # 2 | 3 | apiVersion: v1 4 | kind: ServiceAccount 5 | metadata: 6 | name: admin-user 7 | namespace: kube-system 8 | 9 | --- 10 | 11 | # ------------------- admin-user cluster role binding ------------------- # 12 | 13 | apiVersion: rbac.authorization.k8s.io/v1 14 | kind: ClusterRoleBinding 15 | metadata: 16 | name: admin-user 17 | roleRef: 18 | apiGroup: rbac.authorization.k8s.io 19 | kind: ClusterRole 20 | name: cluster-admin 21 | subjects: 22 | - kind: ServiceAccount 23 | name: admin-user 24 | namespace: kube-system 25 | 26 | --- 27 | 28 | # kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') 29 | -------------------------------------------------------------------------------- /traefik/README.md: -------------------------------------------------------------------------------- 1 | # Traefik 2 | 3 | ![Traefik Logo](images/traefik-logo.svg) 4 | 5 | The main subject of this talk is introducing to the Traefik awesome Cloud Native Edge Router and the new features comming in Traefik 2.0. 6 | 7 | Live slides are available at: 8 | 9 | https://talks.godoc.org/github.com/raelga/kubernetes-talks/traefik/traefik.slide 10 | 11 | Plain text slides in [traefik.slide](traefik.slide). 12 | 13 | ## Traefik Labs 14 | 15 | Work in progress. -------------------------------------------------------------------------------- /traefik/images/README.md: -------------------------------------------------------------------------------- 1 | # Credits 2 | 3 | All images from this folder are from https://docs.traefik.io/ 4 | 5 | - https://github.com/containous/traefik/tree/master/old/docs 6 | - https://github.com/containous/traefik/tree/master/docs/content/assets/img 7 | -------------------------------------------------------------------------------- /traefik/images/traefik-1.0-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-1.0-architecture.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-architecture.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-configuration-discovery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-configuration-discovery.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-entrypoints.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-entrypoints.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-features-cross-provider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-features-cross-provider.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-features-syntax.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-features-syntax.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-features-tcp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-features-tcp.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-features-tls-termination.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-features-tls-termination.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-middleware-addprefix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-middleware-addprefix.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-middleware-errorpage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-middleware-errorpage.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-middleware-headers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-middleware-headers.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-middleware-ratelimit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-middleware-ratelimit.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-middleware.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-middleware.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-routers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-routers.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0-services.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0-services.png -------------------------------------------------------------------------------- /traefik/images/traefik-2.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-2.0.png -------------------------------------------------------------------------------- /traefik/images/traefik-concepts-auto-discovery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-concepts-auto-discovery.png -------------------------------------------------------------------------------- /traefik/images/traefik-concepts-edge-router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-concepts-edge-router.png -------------------------------------------------------------------------------- /traefik/images/traefik-concepts-webui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-concepts-webui.png -------------------------------------------------------------------------------- /traefik/images/traefik-examples-docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-examples-docker.png -------------------------------------------------------------------------------- /traefik/images/traefik-examples-kubernetes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-examples-kubernetes.png -------------------------------------------------------------------------------- /traefik/images/traefik-features.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-features.png -------------------------------------------------------------------------------- /traefik/images/traefik-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raelga/kubernetes-talks/dfb588214c2e41ca3b5cf9b3f7baf9cc121c9325/traefik/images/traefik-overview.png -------------------------------------------------------------------------------- /traefik/labs/docker/host/traefik-docker-host.yaml: -------------------------------------------------------------------------------- 1 | imports: 2 | - path: instance.jinja 3 | 4 | resources: 5 | 6 | - name: traefik-docker-host 7 | type: instance.jinja 8 | properties: 9 | description: "BCN Cloud Traefik instance" 10 | machineType: n1-standard-1 11 | bootDiskSize: 30 12 | deletionProtection: false 13 | reservedPublicAddress: true 14 | allowSSH: true 15 | firewall: 16 | - name: web 17 | ports: [ 80, 20080, 443, 20443 ] 18 | - name: traefik 19 | ports: [ 8080, 28080 ] 20 | - name: mongo 21 | ports: [ 27017 ] 22 | 23 | outputs: 24 | - name: external-address 25 | value: $(ref.traefik-docker-host.externalAddress) 26 | - name: internal-address 27 | value: $(ref.traefik-docker-host.internalAddress) 28 | -------------------------------------------------------------------------------- /traefik/labs/docker/tcp-mongo/01-mongo/README.md: -------------------------------------------------------------------------------- 1 | # Simple TCP and Mongo Backend 2 | 3 | * Start the stack: 4 | 5 | ```shell 6 | docker-compose up -d 7 | ``` 8 | 9 | * Update your `/etc/hosts`: 10 | 11 | ```text 12 | ... 13 | 127.0.0.1 mongo1.local 14 | ``` 15 | 16 | * Connect local `mongo` client to mongo's backend through Traefik: 17 | 18 | ```shell 19 | mongo --host mongo1.local --port 27017 20 | > show dbs 21 | > exit 22 | ``` 23 | 24 | * Cleanup: 25 | 26 | ```shell 27 | docker-compose down -v 28 | ``` 29 | -------------------------------------------------------------------------------- /traefik/labs/docker/tcp-mongo/01-mongo/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | reverse-proxy: 5 | image: containous/traefik:experimental-v2.0 6 | restart: unless-stopped 7 | command: 8 | - "--api" 9 | - "--providers.docker" 10 | - "--entrypoints=Name:mongo Address::27017" 11 | ports: 12 | - "8080:8080" 13 | - "27017:27017" 14 | volumes: 15 | - /var/run/docker.sock:/var/run/docker.sock 16 | 17 | mongo1: 18 | image: mongo 19 | hostname: mongo1.local 20 | restart: unless-stopped 21 | labels: 22 | - "traefik.tcp.routers.mongo.rule=HostSNI(`*`)" 23 | - "traefik.tcp.routers.mongo.entrypoints=mongo" 24 | -------------------------------------------------------------------------------- /traefik/labs/docker/tcp-mongo/02-tls-mongo/README.md: -------------------------------------------------------------------------------- 1 | # TCP with TLS termination in Traefik and Mongo Backend 2 | 3 | * (Optional): Re-generate Certificates: 4 | 5 | ```shell 6 | bash ../root-certs/generate-certificates.sh mongo.local ./ 7 | ``` 8 | 9 | * Start the stack: 10 | 11 | ```shell 12 | docker-compose up -d 13 | ``` 14 | 15 | * Update your `/etc/hosts`: 16 | 17 | ```text 18 | ... 19 | 127.0.0.1 mongo1.local 20 | ``` 21 | 22 | * Connect local `mongo` client to mongo's backend through Traefik: 23 | 24 | ```shell 25 | # Should Error because no TLS 26 | mongo --host mongo1.local --port 27017 27 | # Should work 28 | mongo --host mongo1.local --port 27017 --ssl --sslCAFile=../root-certs/minica.pem --sslPEMKeyFile=./certs/mongo.pem 29 | > show dbs 30 | > exit 31 | ``` 32 | 33 | * Cleanup: 34 | 35 | ```shell 36 | docker-compose down -v 37 | ``` 38 | -------------------------------------------------------------------------------- /traefik/labs/docker/tcp-mongo/02-tls-mongo/tls-certs.toml: -------------------------------------------------------------------------------- 1 | [[tls]] 2 | [tls.certificate] 3 | certFile = "/certs/cert.pem" 4 | keyFile = "/certs/key.pem" 5 | -------------------------------------------------------------------------------- /traefik/labs/docker/tcp-mongo/03-sni-routing-mongo/tls-certs.toml: -------------------------------------------------------------------------------- 1 | [[tls]] 2 | [tls.certificate] 3 | certFile = "/certs/cert.pem" 4 | keyFile = "/certs/key.pem" 5 | -------------------------------------------------------------------------------- /traefik/labs/docker/tcp-mongo/04-tcp-and-http-routing-mongo/tls-certs.toml: -------------------------------------------------------------------------------- 1 | [[tls]] 2 | [tls.certificate] 3 | certFile = "/certs/cert.pem" 4 | keyFile = "/certs/key.pem" 5 | -------------------------------------------------------------------------------- /traefik/labs/docker/traefik-v1.7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM traefik:alpine 2 | 3 | COPY traefik.toml /etc/traefik.toml 4 | COPY kubernetes.toml /etc/kubernetes.toml 5 | 6 | RUN apk update && apk add bash vim 7 | -------------------------------------------------------------------------------- /traefik/labs/docker/traefik-v1.7/context/etc/traefik/file.toml: -------------------------------------------------------------------------------- 1 | # file.toml 2 | 3 | [frontends] 4 | 5 | [frontends.github] 6 | backend = "github" 7 | passHostHeader = false 8 | 9 | [frontends.github.routes.main] 10 | rule = "Host:chell.rael.io" 11 | 12 | [backends] 13 | 14 | [backends.github] 15 | 16 | [backends.github.servers.github] 17 | url = "https://raelga.github.io:443" 18 | -------------------------------------------------------------------------------- /traefik/labs/docker/traefik-v1.7/context/etc/traefik/traefik.toml: -------------------------------------------------------------------------------- 1 | # traefik.toml 2 | 3 | [entryPoints] 4 | [entryPoints.http] 5 | address = ":80" 6 | 7 | [entryPoints.https] 8 | address = ":443" 9 | 10 | logLevel = "DEBUG" 11 | 12 | [traefikLog] 13 | format = "json" 14 | 15 | [accessLog] 16 | 17 | [api] 18 | address = "traefik-v1.docker.do.rael.io:80" 19 | 20 | [docker] 21 | domain = "traefik-v1.docker.do.rael.io" 22 | watch = true 23 | 24 | [file] 25 | watch = true 26 | filename = "/etc/traefik/file.toml" 27 | -------------------------------------------------------------------------------- /traefik/labs/docker/traefik-v2.0/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM traefik:alpine 2 | 3 | COPY traefik.toml /etc/traefik.toml 4 | COPY kubernetes.toml /etc/kubernetes.toml 5 | 6 | RUN apk update && apk add bash vim 7 | -------------------------------------------------------------------------------- /traefik/labs/docker/traefik-v2.0/context/etc/traefik/file.toml: -------------------------------------------------------------------------------- 1 | # file.toml 2 | 3 | [http.middlewares] 4 | 5 | [http.middlewares.secured.chain] 6 | middlewares = [ "known-ips", "auth-users" ] 7 | 8 | [http.middlewares.auth-users.basicauth] 9 | users = ["rael:$apr1$zK14IwpO$tctjsucQ4CcIlStnxT.R/."] 10 | 11 | [http.middlewares.known-ips.ipWhiteList] 12 | sourceRange = [ "54.246.153.221" ] -------------------------------------------------------------------------------- /traefik/labs/docker/traefik-v2.0/context/etc/traefik/traefik.toml: -------------------------------------------------------------------------------- 1 | # traefik.toml 2 | 3 | logLevel = "DEBUG" 4 | 5 | [entryPoints] 6 | 7 | [entryPoints.http] 8 | address = ":80" 9 | 10 | [entryPoints.https] 11 | address = ":443" 12 | 13 | [entryPoints.mongo] 14 | address = ":27017" 15 | 16 | [api] 17 | address = "traefik-v2.docker.rael.io:80" 18 | 19 | [providers] 20 | 21 | [providers.docker] 22 | domain = "traefik-v2.docker.rael.io" 23 | watch = true 24 | 25 | [file] 26 | 27 | [http.middlewares] 28 | 29 | [http.middlewares.secured.chain] 30 | middlewares = [ "known-ips", "auth-users" ] 31 | 32 | [http.middlewares.auth-users.basicauth] 33 | users = ["rael:$apr1$zK14IwpO$tctjsucQ4CcIlStnxT.R/."] 34 | 35 | [http.middlewares.known-ips.ipWhiteList] 36 | sourceRange = [ "54.246.153.221" ] -------------------------------------------------------------------------------- /traefik/labs/k8s/Makefile: -------------------------------------------------------------------------------- 1 | kubectl create secret generic super-secure-password --from-file htpasswd-secret 2 | 3 | k8s-get-chell-traefik-token: 4 | kubectl get -n kube-system -o json secrets \ 5 | | jq -r '.items[] | select (.metadata.annotations."kubernetes.io/service-account.name"=="chell-traefik") | .data.token' \ 6 | | base64 -d 7 | 8 | k8s-get-chell-traefik-ca: 9 | kubectl get -n kube-system -o json secrets \ 10 | | jq -r '.items[] | select (.metadata.annotations."kubernetes.io/service-account.name"=="chell-traefik") | .data."ca.crt"' \ 11 | | base64 -d 12 | -------------------------------------------------------------------------------- /traefik/labs/k8s/default/cats-service-lb-with-typo.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: cats-lb 6 | spec: 7 | type: LoadBalancer 8 | ports: 9 | - name: http 10 | targetPort: 80 11 | port: 80 12 | selector: 13 | app: cats -------------------------------------------------------------------------------- /traefik/labs/k8s/default/cats-service-lb.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: cats-lb 6 | spec: 7 | type: LoadBalancer 8 | ports: 9 | - name: http 10 | targetPort: 80 11 | port: 80 12 | selector: 13 | app: cat -------------------------------------------------------------------------------- /traefik/labs/k8s/default/htpasswd-secret: -------------------------------------------------------------------------------- 1 | traefik:$apr1$aYeavlWa$JS3jsQGa9gzS7N37JH2JK1 2 | -------------------------------------------------------------------------------- /traefik/labs/k8s/default/ttyd-deployment.yaml: -------------------------------------------------------------------------------- 1 | # ttyd: 2 | # image: tsl0922/ttyd 3 | # labels: 4 | # - "traefik.frontend.rule=Host:ttyd.do.rael.io;PathPrefixStrip:/ttyd" -------------------------------------------------------------------------------- /traefik/labs/k8s/default/whoami-deployment.yaml: -------------------------------------------------------------------------------- 1 | kind: Deployment 2 | apiVersion: extensions/v1beta1 3 | metadata: 4 | namespace: default 5 | name: whoami 6 | labels: 7 | app: whoami 8 | 9 | spec: 10 | replicas: 2 11 | selector: 12 | matchLabels: 13 | app: whoami 14 | template: 15 | metadata: 16 | labels: 17 | app: whoami 18 | spec: 19 | containers: 20 | - name: whoami 21 | image: containous/whoami 22 | ports: 23 | - name: web 24 | containerPort: 80 25 | -------------------------------------------------------------------------------- /traefik/labs/k8s/default/whoami-ingress-annotations.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Ingress 3 | metadata: 4 | name: whoami-web 5 | namespace: default 6 | annotations: 7 | kubernetes.io/ingress.class: traefik 8 | traefik.ingress.kubernetes.io/auth-type: "basic" 9 | traefik.ingress.kubernetes.io/auth-secret: "super-secure-password" 10 | spec: 11 | rules: 12 | - host: whoami.traefik.rael.io 13 | http: 14 | paths: 15 | - path: / 16 | backend: 17 | serviceName: whoami 18 | servicePort: web -------------------------------------------------------------------------------- /traefik/labs/k8s/default/whoami-ingress.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: extensions/v1beta1 2 | kind: Ingress 3 | metadata: 4 | name: whoami-web 5 | namespace: default 6 | spec: 7 | rules: 8 | - host: whoami.traefik.rael.io 9 | http: 10 | paths: 11 | - path: / 12 | backend: 13 | serviceName: whoami 14 | servicePort: web -------------------------------------------------------------------------------- /traefik/labs/k8s/default/whoami-service-lb.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | apiVersion: v1 4 | kind: Service 5 | metadata: 6 | name: whoami 7 | 8 | spec: 9 | type: LoadBalancer 10 | ports: 11 | - protocol: TCP 12 | name: web 13 | port: 80 14 | selector: 15 | app: whoami -------------------------------------------------------------------------------- /traefik/labs/k8s/default/whoami-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | apiVersion: v1 4 | kind: Service 5 | metadata: 6 | name: whoami 7 | 8 | spec: 9 | ports: 10 | - protocol: TCP 11 | name: web 12 | port: 80 13 | selector: 14 | app: whoami -------------------------------------------------------------------------------- /traefik/labs/k8s/traefik/traefik-chell-sa.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ServiceAccount 4 | metadata: 5 | name: chell-traefik 6 | namespace: kube-system -------------------------------------------------------------------------------- /traefik/labs/k8s/traefik/traefik-ns.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | apiVersion: v1 4 | kind: Namespace 5 | metadata: 6 | name: traefik -------------------------------------------------------------------------------- /traefik/labs/k8s/traefik/traefik-v1.0-ingress.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | apiVersion: extensions/v1beta1 4 | kind: Ingress 5 | metadata: 6 | name: traefik-web-ui 7 | namespace: traefik 8 | 9 | spec: 10 | rules: 11 | - host: traefik-ui.traefik.rael.io 12 | http: 13 | paths: 14 | - path: / 15 | backend: 16 | serviceName: traefik-v1 17 | servicePort: web -------------------------------------------------------------------------------- /traefik/labs/k8s/traefik/traefik-v1.0-service-lb.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | kind: Service 4 | apiVersion: v1 5 | metadata: 6 | name: traefik-v1 7 | namespace: traefik 8 | spec: 9 | type: LoadBalancer 10 | selector: 11 | k8s-app: traefik-v1 12 | ports: 13 | - protocol: TCP 14 | port: 80 15 | name: web 16 | - protocol: TCP 17 | port: 8080 18 | name: admin -------------------------------------------------------------------------------- /traefik/labs/k8s/traefik/traefik-v1.0-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | kind: Service 4 | apiVersion: v1 5 | metadata: 6 | name: traefik-v1 7 | namespace: traefik 8 | spec: 9 | selector: 10 | k8s-app: traefik-v1 11 | ports: 12 | - protocol: TCP 13 | port: 80 14 | name: web 15 | - protocol: TCP 16 | port: 8080 17 | name: admin -------------------------------------------------------------------------------- /traefik/labs/k8s/traefik/traefik-v2.0-authentication-middleware.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | apiVersion: traefik.containo.us/v1alpha1 4 | kind: Middleware 5 | metadata: 6 | name: authentication 7 | namespace: traefik 8 | spec: 9 | basicauth: 10 | auth-type: "basic" 11 | auth-secret: "super-secure-password" -------------------------------------------------------------------------------- /traefik/labs/k8s/traefik/traefik-v2.0-customResourceDefinition.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apiextensions.k8s.io/v1beta1 2 | kind: CustomResourceDefinition 3 | metadata: 4 | name: ingressroutes.traefik.containo.us 5 | 6 | spec: 7 | group: traefik.containo.us 8 | version: v1alpha1 9 | names: 10 | kind: IngressRoute 11 | plural: ingressroutes 12 | singular: ingressroute 13 | scope: Namespaced 14 | 15 | --- 16 | 17 | apiVersion: apiextensions.k8s.io/v1beta1 18 | kind: CustomResourceDefinition 19 | metadata: 20 | name: middlewares.traefik.containo.us 21 | spec: 22 | group: traefik.containo.us 23 | version: v1alpha1 24 | names: 25 | kind: Middleware 26 | plural: middlewares 27 | singular: middleware 28 | scope: Namespaced 29 | -------------------------------------------------------------------------------- /traefik/labs/k8s/traefik/traefik-v2.0-headers-middleware.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | apiVersion: traefik.containo.us/v1alpha1 4 | kind: Middleware 5 | metadata: 6 | name: myheaders 7 | namespace: traefik 8 | spec: 9 | headers: 10 | customRequestHeaders: 11 | - mode: dep 12 | -------------------------------------------------------------------------------- /traefik/labs/k8s/traefik/traefik-v2.0-service-lb.yaml: -------------------------------------------------------------------------------- 1 | 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: traefik-v2 6 | namespace: traefik 7 | 8 | spec: 9 | type: LoadBalancer 10 | ports: 11 | - protocol: TCP 12 | name: web 13 | port: 80 14 | - protocol: TCP 15 | name: admin 16 | port: 8080 17 | - protocol: TCP 18 | name: websecure 19 | port: 443 20 | selector: 21 | app: traefik-v2 -------------------------------------------------------------------------------- /traefik/labs/k8s/traefik/traefik-v2.0-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | kind: Service 4 | apiVersion: v1 5 | metadata: 6 | name: traefik-v2-service 7 | namespace: traefik 8 | spec: 9 | selector: 10 | k8s-app: traefik-v2-lb 11 | ports: 12 | - protocol: TCP 13 | port: 80 14 | name: web 15 | - protocol: TCP 16 | port: 8080 17 | name: admin --------------------------------------------------------------------------------