ansible-for-kubernetes icon indicating copy to clipboard operation
ansible-for-kubernetes copied to clipboard

[Chapter 1] Reordering + docker content suggestion.

Open timoc opened this issue 4 years ago • 0 comments

I'm going through this book on a windows7 laptop. Just finished chapter 1. Liking it so far. This is a brain-dump of my experience with a suggestion before I move on to chapter 2.

My comments come from being an intermediate to expert ansible guy, I bought this book to help transition my ansible based VMs to container and k8s.

Setting up the tooling for Chapter 1 in windows 7 is tricky, trickier if you follow the order in the book. You go directly into creating a Dockerfile based container build without installing docker, or even kicking its tyres a little to show what its about and how it is fundamentally different from VM's. Kicking the local docker install around a bit also helped me figure out the various wrinkles in the windows version, so i could get the examples working in the way i wanted.

My first suggestion is to leverage docker and minikube from the beginning. Start with the docker and minikube (with kubectl) install before getting to the hello world. Once installed the (windows 7) minikube setup comes with docker, virtualbox, git, git-bash. Starting here means every other tool can be contained (pardon the pun) within a disposable development environment. Bonus points if it is your own container hosted on dockerhub with this repo :)

Second suggestion is before going into Dockerfiles and k8s, take a chance to demonstrate how docker containers and layers work. It is fundamentally different from the way you build VMs. It implies so much about how you need to think about refactoring existing ansible. I found the best resource is the storage manual https://docs.docker.com/storage/storagedriver/,

Third suggestion is to test the docker install by using the golang:1-alpine container as a golang buld environment, rather than install go locally. This allowed me to use my local editor (golang:1-alpine only has vi) to create hello.go. Alongside that i had an interactive docker shell to do the compile/build with the source code tree mapped to a volume. docker run --publish 8180:8180 --rm -it --name gohello-dev -v $PWD:/go/src/github.com/hello-go/ golang:1-alpine

In another shell I used docker inspect and docker machine to examine the running container and supporting virtualbox infrastructure. This was also pretty handy for debugging the local bind and port problems in the windows docker i am using,

timoc avatar Jul 16 '20 23:07 timoc