<!-- .slide: class="center" data-background-image="https://k8s.work/title.jpg" data-background-size="100%" -->
## A kind workflow
### for contributing to
## Kubernetes!
slide: [kind.k8s.work](https://kind.k8s.work)
`curl -L kind.k8s.work/fetch | bash`
<!-- Note from session [patricklang]
- the resulting /tmp/kind-cache.tar.gz wasn't accessible on the Windows OS side.
Windows: `curl.exe -L kind.k8s.work/fetch | cmd`
once that finishes, run `docker ps`, get the container ID, then `docker cp <containerid>:/tmp/kind-cache.tar.gz .` and last `docker load -i kind-cache.tar.gz`
-->
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Go Get The BITS!!
<br/>
##### This will download everything needed for the workshop!
```
curl -L kind.k8s.work/fetch | bash
# Windows: curl.exe -L kind.k8s.work/fetch | cmd
docker run --rm -i -v /tmp:/tmp --network=host quay.io/kind-workshop/kind-fetch
```
> Note: Using Windows? Be sure to use `curl.exe` and pipe to `cmd`
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Who are we?
|  |  |
| --------------------------------- | -------------------------------- |
|  |  |
| | :sparkles: 4 different companys, one team. :sparkles: | |
|-|-|-|
`curl -L kind.k8s.work/fetch | bash`
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Welcome Everyone!
### Let's get to know one another!
A few questions:
* Did you bring a laptop?
* Do you have docker installed?
* Have you contributed to Kubernetes before?
<br/>
<br/>
`curl -L kind.k8s.work/fetch | bash`
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Agenda:
* Get Docker installed!
* Get "the bits!"
* Overview of the Kind Project
* Overview of contributing to Kubernetes
* Sample Commit
* Let's build from before the sample commit
* Let's build our cloned version of the patch
* Let's verify things work as work as expected!
* Profit!
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Let's get docker installed.
* For the MAC: https://docs.docker.com/docker-for-mac/install/
* For Windows: https://docs.docker.com/docker-for-windows/install/
* For linux:
* Ubuntu: https://docs.docker.com/v17.12/install/linux/docker-ce/ubuntu/
* Fedora: https://docs.docker.com/v17.12/install/linux/docker-ce/fedora
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Check Docker Desktop settings
#### https://kind.sigs.k8s.io/docs/user/quick-start/#settings-for-docker-desktop

<!-- Note from session [patricklang]:
This would have been a good "walk-in" slide along with the docker run ... kind-fetch. Some people were failing during fetch because disk image max size was too low.
-->
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Start your wifi. Make some waves!
##### If you have already pulled `quay.io/kind-workshop/kind-cache` you don't need to do this! also THANKS!
```
curl -L kind.k8s.work/fetch | bash
# Windows: curl.exe -L kind.k8s.work/fetch | cmd
```
This will download a flattened image that has all the bits needed for the workshop.
It will do this using aria2 and will multiget it from 10 servers in us-west-1
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Wait, what are we downloading?
##### These are all things you'll need to build & deploy with Kind in this workshop
```
What Size
--------------------------------------
kind-buildenv:1.13 1.37GB
kindest/base:latest 329MB
etcd:3.3.10 258MB
kube-cross:v1.12.7-1 1.75GB
coredns:1.3.1 40.3MB
kindnetd:0.5.0 81.8MB
debian-iptables-amd64:v11.0.2 45.4MB
debian-base-amd64:v1.0.0 42.3MB
pause:3.1 742kB
```
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### This is *NOT* real life :)
In real life you would have all of kubernetes checked out and would likely be running `kind` from you laptop via
```
brew install kind
choco install kind
```
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### This lab is canned!
Once all of the resources are downloaded we can do this entire lab offline.
Note:
We also provide a buildenv so that we can reduce the dependencies down to just the Docker Daemon! :)
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### go get kubernetes
go get -d k8s.io/kubernetes This will take a minute
Why not github.com/kubernetes/kubernetes?
Note:
When we go get the kubernetes codebase we want to check it out from k8s.io/kubernetes even tho it's hosted at github.com/kubernetes/kubernetes.
This is important because the import paths make assumptions about where to go to find modules and all of the kubernetes specific import paths begin with k8s.io/
---
<!-- .slide: class="center" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
## What is kind?

---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/kind1.png" data-background-size="100%" -->
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/kind2.png" data-background-size="100%" -->
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Contributors get free cache!
For this session, we've asked everyone to download an image ahead of time. This isn't what you'd do at home, but it keeps us from waiting on wifi today :)
Let's start up the cache, and get it's IP:
```
$ curl -L kind.k8s.work/cache
docker run --rm --name kind-cache -v /var/run/docker.sock:/var/run/docker.sock quay.io/kind-workshop/kind-cache
```
> Note: Using PowerShell? Be sure to use `curl.exe`
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Start up a build environment
This has golang, git, bazel and all the other tools you need ready to go.
```
$ curl -L kind.k8s.work/buildenv
docker run --rm -d --name buildenv --hostname buildenv -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp quay.io/kind-workshop/kind-buildenv:1.13
```
Once that's started, shell into it
```
docker exec -it buildenv bash
```
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Let's see what we're testing
```
root@buildenv:/go/src/k8s.io/kubernetes# git log
commit 97c4edaa4f28f914db45766330b6db8953720588 (HEAD -> fix)
Author: louisssgong <louisssgong@tencent.com>
Date: Sat Aug 3 17:44:12 2019 +0800
Fix a bug in the IPVS proxier where virtual servers are not cleaned up even though the corresponding Service object was deleted.
```
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Build before the change
```
kind build node-image --image=local:master
```
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Build a cluster
```
cd /go
kind create cluster --config kind-config.yaml --image=local:master
```
```
kind get kubeconfig --internal > ~/.kube/config
kubectl get pods -Aw
```
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Testing it out
```
kubectl create deploy test --image=k8s.gcr.io/pause:3.1
kubectl expose deploy test --port 80
```
```
docker exec -ti kind-control-plane ip addr show dev kube-ipvs0
kubectl get svc -o wide
```
```
kubectl delete svc test
docker exec -ti kind-control-plane ip addr show dev kube-ipvs0
```
> Hmm, the interface should have been removed, but it wasn't
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Cleaning up before testing the fix
```
kind delete cluster
```
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Build after the change
```
kind build node-image --image=local:fix
```
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Build a cluster with the fix
```
cd /go
kind create cluster --config kind-config.yaml --image=local:fix
```
```
kind get kubeconfig --internal > ~/.kube/config
kubectl get pods -Aw
```
```
kubectl delete svc test
docker exec -ti kind-control-plane ip addr show dev kube-ipvs0
```
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Testing the fix
```
kubectl create deploy test --image=k8s.gcr.io/pause:3.1
kubectl expose deploy test --port 80
```
```
docker exec -ti kind-control-plane ip addr show dev kube-ipvs0
kubectl get svc -o wide
```
---
<!-- .slide: style="text-align: left;" data-background-image="https://k8s.work/blank.jpg" data-background-size="100%" -->
### Cleaning up!
`docker stop buildenv`
`docker system prune --volumes`
`docker system prune`
---
<!-- .slide: class="center" data-background-image="https://k8s.work/endcap.jpg" data-background-size="100%" -->
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
### Thanks everyone!
#### Keep Being `KinD`
{"metaMigratedAt":"2023-06-15T01:11:45.775Z","metaMigratedFrom":"YAML","title":"A kind workflow for contributing to Kubernetes","breaks":true,"description":"Deck for https://sched.co/Uaek","slideOptions":"{\"theme\":\"solarized\",\"center\":false}","contributors":"[{\"id\":\"cadf782c-5b2d-4f3b-8fd3-fda683aa9c65\",\"add\":11160,\"del\":2585},{\"id\":\"e207d835-4d64-499b-8c98-d2654f8d1b6f\",\"add\":10760,\"del\":8762}]"}