diff --git a/index.md b/index.md index f3a53eb..141f04d 100644 --- a/index.md +++ b/index.md @@ -23,6 +23,9 @@ features: details: "Notes from the book Designing Data-Intensive Applications" - title: "Concurrency in Go" link: /go-concurrency/README.md - details: "Notes from the book Concurrency in Go" + details: "Cookbook for writing concurrent and parallel programs in Go" + - title: "Kubernetes in Action" + link: /k8s-in-action/README.md + details: "How to deploy and manage containerized applications at scale in production using Kubernetes" --- diff --git a/k8s-in-action/README.md b/k8s-in-action/README.md index b21a1da..e3251d6 100644 --- a/k8s-in-action/README.md +++ b/k8s-in-action/README.md @@ -1,6 +1,6 @@ - # Kubernetes in action ## Table of Contents -- [Part 1. Overview](./overview/overview.md) \ No newline at end of file +- [Chapter 1. Introducing Kubernetes](./overview/chapter-1-introducing-kubernetes/chapter-1-introducing-kubernetes.md) +- [Chapter 2. First steps with Docker and Kubernetes](./overview/chapter-2-first-steps-with-docker-and-k8s/chapter-2-first-steps-with-docker-and-k8s.md) diff --git a/k8s-in-action/overview/chapter-1-introducing-kubernetes/chapter-1-introducing-kubernetes.md b/k8s-in-action/overview/chapter-1-introducing-kubernetes/chapter-1-introducing-kubernetes.md index 3753109..29004ef 100644 --- a/k8s-in-action/overview/chapter-1-introducing-kubernetes/chapter-1-introducing-kubernetes.md +++ b/k8s-in-action/overview/chapter-1-introducing-kubernetes/chapter-1-introducing-kubernetes.md @@ -68,7 +68,7 @@ A container, on the other hand, is nothing more than a single isolated process r Also with VM you often group up multiple components into a single VM, while with containers you can run each component in a separate container. -![](./vm-vs-containers.png) +![](docs/vm-vs-containers.png) 3 completely separate OS running and sharing the same hardware resources, which devided by the hypervisor of the host OS. All calls to the kernel are handled @@ -76,7 +76,7 @@ by the hypervisor. Containers perform all system calls on the exact same kernel running the host OS. -![](./vm-vs-containers-kernel.png) +![](docs/vm-vs-containers-kernel.png) The main benefit of virtual machines is the full isolation they provide, because each VM runs its own Linux kernel, while containers all call out to the same kernel, which can clearly pose a security risk. @@ -151,14 +151,14 @@ Main concepts: #### Building, distributing, and running a Docker image -![](./docker-process.png) +![](docs/docker-process.png) #### Comparing Virtual Machines and Docker containers Apps A and B have access to same binaries and libraries both when running in VM and when running in separate Docker containers. Why? -![](./vm-docker.png) +![](docs/vm-docker.png) #### Understanding image layers @@ -214,7 +214,7 @@ Kubernetes enables you to run your software applications on thousands of compute When the developer sub- mits a list of apps to the master, Kubernetes deploys them to the cluster of worker nodes. What node a component lands on doesn’t (and shouldn’t) matter—neither to the developer nor to the system administrator. -![](./k8s-nodes.png) +![](docs/k8s-nodes.png) The developer can specify that certain apps must run together and Kubernetes will deploy them on the same worker node. Others will be spread around the cluster, but they can talk to each other in the same way, regardless of where they’re deployed. @@ -239,7 +239,7 @@ At the hardware level k8s cluster is composed of many nodes, which can split int - worker nodes > runs the actual applications -![](./k8s-architecture.png) +![](docs/k8s-architecture.png) #### The control plane @@ -288,7 +288,7 @@ starts the instructs the Container runtime to pull the required image and start the container -> Kube-proxy on each node configures the network to allow the containers to communicate with each other and with the outside world. -![](./k8s-running.png) +![](docs/k8s-running.png) #### Keeping the containers running diff --git a/k8s-in-action/overview/chapter-1-introducing-kubernetes/docker-process.png b/k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/docker-process.png similarity index 100% rename from k8s-in-action/overview/chapter-1-introducing-kubernetes/docker-process.png rename to k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/docker-process.png diff --git a/k8s-in-action/overview/chapter-1-introducing-kubernetes/k8s-architecture.png b/k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/k8s-architecture.png similarity index 100% rename from k8s-in-action/overview/chapter-1-introducing-kubernetes/k8s-architecture.png rename to k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/k8s-architecture.png diff --git a/k8s-in-action/overview/chapter-1-introducing-kubernetes/k8s-nodes.png b/k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/k8s-nodes.png similarity index 100% rename from k8s-in-action/overview/chapter-1-introducing-kubernetes/k8s-nodes.png rename to k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/k8s-nodes.png diff --git a/k8s-in-action/overview/chapter-1-introducing-kubernetes/k8s-running.png b/k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/k8s-running.png similarity index 100% rename from k8s-in-action/overview/chapter-1-introducing-kubernetes/k8s-running.png rename to k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/k8s-running.png diff --git a/k8s-in-action/overview/chapter-1-introducing-kubernetes/vm-docker.png b/k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/vm-docker.png similarity index 100% rename from k8s-in-action/overview/chapter-1-introducing-kubernetes/vm-docker.png rename to k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/vm-docker.png diff --git a/k8s-in-action/overview/chapter-1-introducing-kubernetes/vm-vs-containers-kernel.png b/k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/vm-vs-containers-kernel.png similarity index 100% rename from k8s-in-action/overview/chapter-1-introducing-kubernetes/vm-vs-containers-kernel.png rename to k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/vm-vs-containers-kernel.png diff --git a/k8s-in-action/overview/chapter-1-introducing-kubernetes/vm-vs-containers.png b/k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/vm-vs-containers.png similarity index 100% rename from k8s-in-action/overview/chapter-1-introducing-kubernetes/vm-vs-containers.png rename to k8s-in-action/overview/chapter-1-introducing-kubernetes/docs/vm-vs-containers.png diff --git a/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/chapter-2-first-steps-with-docker-and-k8s.md b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/chapter-2-first-steps-with-docker-and-k8s.md index d83687a..d8f35db 100644 --- a/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/chapter-2-first-steps-with-docker-and-k8s.md +++ b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/chapter-2-first-steps-with-docker-and-k8s.md @@ -1,38 +1,40 @@ -# Chapter 2. First steps with Docker and Kubernetes +# Chapter 2. First steps with Docker and Kubernetes -## 2.1 Creating, running, and sharing a container image +## 2.1 Creating, running, and sharing a container image -### 2.1.1 Installing Docker and run Hello World container +### 2.1.1 Installing Docker and run Hello World container -#### Running a Hello world container +#### Running a Hello world container ```bash docker run busybox echo "Hello world" ``` -App was executed inside a container, isolated from another processes. +App was executed inside a container, isolated from another processes. ### Understanding what happens behind the scenes -![](./run.png) +![](docs/docker-run.png) -#### Running other images +#### Running other images ```bash docker run ``` -#### Versioning container images +#### Versioning container images -All software packages get updated, so more than a single version of a package usually exists. Docker supports having multiple versions or variants of the same image under the same name. Each variant must have a unique tag. +All software packages get updated, so more than a single version of a package usually exists. Docker supports having +multiple versions or variants of the same image under the same name. Each variant must have a unique tag. -When referring to images with- out explicitly specifying the tag, Docker will assume you’re referring to the so-called latest tag. +When referring to images with- out explicitly specifying the tag, Docker will assume you’re referring to the so-called +latest tag. ```bash docker run : ``` -### 2.1.2 Creating a trivial Node.js app +### 2.1.2 Creating a trivial Node.js app ```js const http = require('http'); @@ -52,9 +54,10 @@ www.listen(8080); Run locally with `node app.js` -### 2.1.3 Creating a Dockerfile for the image +### 2.1.3 Creating a Dockerfile for the image -To package your app into an image, you first need to create a file called Dockerfile, which will contain a list of instructions that Docker will perform when building the image. +To package your app into an image, you first need to create a file called Dockerfile, which will contain a list of +instructions that Docker will perform when building the image. ```Dockerfile FROM node:7 @@ -66,7 +69,7 @@ ENTRYPOINT [ "node", "app.js" ] - `ADD` copies the app.js file from the current directory into the container image. - `ENTRYPOINT` defines the command that will be executed when the container starts. -### 2.1.4 Building the container Image +### 2.1.4 Building the container Image ```bash docker build -t kubia . @@ -74,27 +77,29 @@ docker build -t kubia . - `-t` flag is used to tag the image with a name. -![](./build.png) +![](docs/build.png) -#### Understanding how an image is built +#### Understanding how an image is built -The build process isn’t performed by the Docker client. Instead, the contents of the whole directory are uploaded to the Docker daemon and the image is built there. +The build process isn’t performed by the Docker client. Instead, the contents of the whole directory are uploaded to the +Docker daemon and the image is built there. The client and daemon don't need to be on the same machine at all. -Before actual building Docker will pull all the layers for the base image +Before actual building Docker will pull all the layers for the base image from the registry if they don't exist locally. -#### Understanding image layers +#### Understanding image layers An image isn’t a single, big, binary blob, but is composed of multiple layers. -If you create multiple images based on the same base image, all the layers +If you create multiple images based on the same base image, all the layers comprising the base image will be stored only once. -Also, when pulling an image, Docker will download each layer individually. Several layers may already be stored on your machine, so Docker will only download those that aren’t. +Also, when pulling an image, Docker will download each layer individually. Several layers may already be stored on your +machine, so Docker will only download those that aren’t. -![](./layers.png) +![](docs/layers.png) ```sh docker images kubia @@ -102,36 +107,38 @@ docker images kubia #### Comparing building images with Dockerfile vs. manually -Dockerfiles are the usual way of building container images with Docker, but you could also build the image manually by running a container from an existing image, -executing commands in the container, and then committing the container final state -as a new image. +Dockerfiles are the usual way of building container images with Docker, but you could also build the image manually by +running a container from an existing image, +executing commands in the container, and then committing the container final state +as a new image. -This is exactly what happens when you build from a Dockerfile, but it’s performed automatically and is repeatable, which allows you to make changes to +This is exactly what happens when you build from a Dockerfile, but it’s performed automatically and is repeatable, which +allows you to make changes to the Dockerfile and rebuild the image any time, without retyping all the commands. -### 2.1.5 Running the container image +### 2.1.5 Running the container image ```sh docker run --name kubia-container -p 8080:8080 -d kubia ``` -Telling docker to run the container with name `kubia-container`, map the local -port `8080` to the container port `8080`, and run it in the background (`-d`) +Telling docker to run the container with name `kubia-container`, map the local +port `8080` to the container port `8080`, and run it in the background (`-d`) based on the image `kubia`. -#### Accessing your app +#### Accessing your app ```sh curl localhost:8080 ``` -#### Listing all running containers +#### Listing all running containers ```sh docker ps ``` -#### Getting additional information about a container +#### Getting additional information about a container ```sh docker inspect @@ -139,11 +146,12 @@ docker inspect Will print some low-level container information in JSON format. -### 2.1.6 Exploring the inside of a running container +### 2.1.6 Exploring the inside of a running container -Because multiple processes can run inside the same container, you can always run an addi- tional process in it to see what’s inside. You can even run a shell, provided that the shell’s binary executable is available in the image. +Because multiple processes can run inside the same container, you can always run an addi- tional process in it to see +what’s inside. You can even run a shell, provided that the shell’s binary executable is available in the image. -#### Running a shell inside an existing container +#### Running a shell inside an existing container ```sh docker exec -it bash @@ -151,13 +159,14 @@ docker exec -it bash This will run `bash` inside the container and attach the terminal to it. -The `bash` process will be run in the same Linux namespace as the main container -process. +The `bash` process will be run in the same Linux namespace as the main container +process. - `-i` flag tells Docker to keep the stdin stream open, so you can send commands to the shell. -- `-t` flag tells Docker to allocate a pseudo-TTY, which allows you to attach your terminal to the shell running in the container. +- `-t` flag tells Docker to allocate a pseudo-TTY, which allows you to attach your terminal to the shell running in the + container. -#### Exploring the container form within +#### Exploring the container form within ```sh ps aux @@ -165,22 +174,27 @@ ps aux Only three processes - no one from the host system. -#### Understanding that processes in a container run in the host OS +#### Understanding that processes in a container run in the host OS ```sh ps aux | grep node ``` -If you now open another terminal and list the processes on the host OS itself, you will, among all other host processes, also see the processes running in the container. -> If using Mac or Windows need to login into the VM first. +If you now open another terminal and list the processes on the host OS itself, you will, among all other host processes, +also see the processes running in the container. +> If using Mac or Windows need to login into the VM first. -This proves that processes running in the container are running in the host OS. If you have a keen eye, you may have noticed that the processes have different IDs inside the container vs. on the host. The container is using its own PID Linux namespace and has a completely isolated process tree, with its own sequence of numbers. +This proves that processes running in the container are running in the host OS. If you have a keen eye, you may have +noticed that the processes have different IDs inside the container vs. on the host. The container is using its own PID +Linux namespace and has a completely isolated process tree, with its own sequence of numbers. -#### The container's filesystem is also isolated +#### The container's filesystem is also isolated -Like having an isolated process tree, each container also has an isolated filesystem. Listing the contents of the root directory inside the container will only show the files in the container and will include all the files that are in the image plus any files that are created while the container is running. +Like having an isolated process tree, each container also has an isolated filesystem. Listing the contents of the root +directory inside the container will only show the files in the container and will include all the files that are in the +image plus any files that are created while the container is running. -### 2.1.7 Stopping and removing a container +### 2.1.7 Stopping and removing a container ```sh docker stop @@ -192,15 +206,16 @@ To check that the container is stopped, run `docker ps -a`. docker rm ``` -### 2.1.8 Pushing the image to an image registry +### 2.1.8 Pushing the image to an image registry -The image you’ve built has so far only been available on your local machine. To allow you to run it on any other machine, you need to push the image to an external image registry. +The image you’ve built has so far only been available on your local machine. To allow you to run it on any other +machine, you need to push the image to an external image registry. Docker Hub will allow you to push an image if the image’s repository name starts with your Docker Hub ID. Like `/` -#### Tagging an image under an additional tag +#### Tagging an image under an additional tag ```sh docker tag kubia /kubia @@ -210,7 +225,7 @@ This doesn’t rename the tag; it creates an additional tag for the same image. By `docker images` you can see that the image has two tags. -#### Pushing the image to Docker Hub +#### Pushing the image to Docker Hub ```sh docker push /kubia @@ -218,7 +233,7 @@ docker push /kubia > Login to Docker Hub first. -#### Running the image on a different machine +#### Running the image on a different machine ```sh docker run -p 8080:8080 -d /kubia @@ -226,49 +241,285 @@ docker run -p 8080:8080 -d /kubia After the push to Docker Hub is complete, the image will be available to everyone. -It doesn’t get much simpler than that. And the best thing about this is that your application will have the exact same environment every time and everywhere it’s run. +It doesn’t get much simpler than that. And the best thing about this is that your application will have the exact same +environment every time and everywhere it’s run. -## 2.2 Setting up a Kubernetes cluster +## 2.2 Setting up a Kubernetes cluster Setting up a cluster from a beginning it isn't a simple task. -We can use single-node local cluster or cluster configured by the cloud providers. +We can use single-node local cluster or cluster configured by the cloud providers. ### 2.2.1 Running a local single-node Kubernetes cluster with Minikube -Minikube is a tool that sets up a single-node cluster that’s great for both testing Kubernetes and developing apps locally. +Minikube is a tool that sets up a single-node cluster that’s great for both testing Kubernetes and developing apps +locally. #### Installing Minikube -https://github.com/kubernetes/minikube +- https://github.com/kubernetes/minikube +- https://minikube.sigs.k8s.io/docs/start/ -I'm using Mac M1 so because of that I'm using minikube with podman driver. - -> I didn't remember all previous commands, because I set up it earlier. +#### Installing the Kubernetes client (kubectl) ```sh -podman machine start podman-machine-default +brew install kubectl ``` +#### Checking to see the cluster is up and kubectl can talk to it + ```sh -minikube start --driver=podman +kubectl cluster-info ``` -> 🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default +> I'll skip all parts which are related to Google Cloud Platform. -> But it still have crushes with M1 - it's better to use cloud provider. +### 2.2.3 Setting up alias for `kubectl` -#### Installing the Kubernetes client (kubectl) +```sh +alias k=kubectl -```sh -brew install kubectl +# bash completion for tabbing, need to install bash-completion +source <(kubectl completion bash | sed s/kubectl/k/g) ``` -#### Checking to see the cluster is up and kubectl can talk to it +> Also, can install `oh-my-zsh` and use `kubectl` plugin. +> +> https://github.com/ohmyzsh/ohmyzsh -```sh -kubectl cluster-info +### 2.3.1 Deploying your Node.js app + +The simplest way is to run `kubectl run` command without configuration file. + +```sh +kubectl run kubia --image=luksa/kubia --port=8080 +``` + +#### Introducing pods + +Kubernetes doesn't deal with individual containers directly. + +Instead, it groups containers into logical units called **pods**. + +A **pod** is a group of one or more tightly related containers that will always run together on the same worker node and +in the same Linux namespace. + +Each pod is like a separate logical machine with its own IP, hostname, processes, and so on, running a single +application. + +The application can be a single process, running in to a single container, or it can be a main application process and +additional supporting processes, each running in its own container. + +To better understand the relationship between containers, pods, and nodes: + +![](./docs/pod-container-node.png) + +Each pod has its own IP and contains one or more containers, each running an application process. + +Pods are spread out across different worker nodes. + +#### Listing pods + +```sh +kubectl get pods +``` + +About pod statuses: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/ + +Pending (downloading images) -> Running -> Succeeded (finished) + +To see more information about a pod, run: + +```shell +kubectl describe pod kubia +``` + +#### Understanding what happened behind the scenes + +![](./docs/kubectl-run.png) + +### 2.3.2 Accessing your web application + +Each pod gets its own IP address, but this address is **internal** to the cluster and isn’t accessible from outside of +it. + +To make the pod accessible from the outside, you’ll expose it through a `Service` object. + +About service types: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types + +TL;DR: using `LoadBalancer` instead `ClusterIP` because the first one is exposing the service to the outside world. + +#### Create a Service object + +```sh +kubectl expose pod kubia --type LoadBalancer --name kubia-http +``` + +#### Listing services + +```sh +kubectl get services +``` + +> It may take a few seconds for the service to be assigned an external IP address. +> +> Minikube doesn't support LoadBalancer type, so it will be `pending` forever. + +#### Accessing your service through its external IP + +```sh +curl : +``` + +Accessing in Minikube: + +```sh +minikube service kubia-http +``` + +Pod name = hostname. + +### 2.3.3 The logical parts of your system + +Worker node = VM + Docker + kubelet + kube-proxy +Master node = API server + scheduler + controller manager + etcd + +We don't care about the hosting of master components (split between multiple machines), +because we are only interacting with the API server. + +#### Understanding how the RC, the Pod, and the Service fit together + +![](./docs/rc-pod-service.png) + +Replication Controller (RC) is a Kubernetes object that ensures that a specified number of pod replicas are running at +any one time. + +Pods are ephemeral (can be created, deleted, and moved around at any time) - IP addresses are not stable, so we need +Service to provide a stable IP address and DNS name for a set of pods. + +Requests coming to the IP and port of the service will be forwarded to the IP and port of one of the pods belonging to +the service at that moment. + +### 2.3.4 Horizontally scaling the application + +> In book used previous version of Kubernetes, and `--generator` flag is deprecated now. + +Creating `ReplicationController` via spec file: + +```yaml +apiVersion: v1 +kind: ReplicationController +metadata: + name: kubia +spec: + replicas: 3 + selector: + app: kubia + template: + metadata: + labels: + app: kubia + spec: + containers: + - name: kubia + image: luksa/kubia + ports: + - containerPort: 8080 +``` + +```shell +kubectl apply -f rc.yaml +``` + +```shell +kubectl get rc +``` + +Exposing the RC as a service: + +```shell +kubectl expose rc kubia --type=LoadBalancer --name kubia-http-v2 +``` + +```shell +``` + +#### Increasing the desired replica count + +```shell +k scale rc kubia --replicas 5 +``` + +We didn't instruct Kubernetes how to scale the application, we only told it what the desired state is. + +This is one of the most fundamental Kubernetes principles. Instead of telling Kubernetes exactly what actions it should +perform, you’re only declaratively changing the desired state of the system and letting Kubernetes examine the current +actual state and reconcile it with the desired state. + +#### Seeing the results of the scale-out + +```shell +kubectl get pods -o wide +``` + +Keep in mind that the app itself needs to support being scaled horizontally. Kubernetes doesn't magically make your app +scalable; it only makes it trivial to scale the app up or down. + +#### Seeing requests hit all three pods when hitting the service + +```shell +URL=$(minikube service kubia-http-v2 --url) + +while true; do curl "$URL"; sleep 0.5; done +``` + +#### Visualizing the new state of your system + +![](./docs/replication-controller.png) + +### 2.3.5 Examining what nodes your app is running on + +You may be wondering what nodes your pods have been scheduled to. + +In the k8s world, what node a pod is running on isn't that important, as long as it gets scheduled to a node that can +provide the CPU and memory the pod needs to run properly. + +Each pod has its own IP and can talk to any other pod, regardless of whether that other pod is also running on the same +node or on a different one. + +#### Displaying the pod IP and the Node when listing pods + +```shell +kubectl get pods -o wide +``` + +#### Inspecting other details of a pod with `kubectl describe` + +```shell +kubectl describe pod kubia +``` + +This shows, among other things, the node the pod has been scheduled to, the time when it was started, the image(s) it's +running, and other useful information. + +### 2.3.6 Introducing the Kubernetes Dashboard + +The Kubernetes Dashboard is a web-based UI that you can use to inspect your cluster - +another way to interact with your cluster. + +```shell +minikube dashboard ``` +## 2.4 Summary +After reading this chapter, you should now know how to: +- Pull and run any publicly available container image +- Package your apps into container images and make them available to others +- Entering a running container to inspect its environment +- Alias `kubectl` to `k` and enable bash completion +- List and inspect nodes, pods, services and replication controllers in your cluster +- Have basic sense of how pods, rc and services relate to each other +- Scale up and down your app by changing the desired state of the system +- Access the web-based Kubernetes Dashboard \ No newline at end of file diff --git a/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/build.png b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/build.png similarity index 100% rename from k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/build.png rename to k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/build.png diff --git a/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/run.png b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/docker-run.png similarity index 100% rename from k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/run.png rename to k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/docker-run.png diff --git a/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/kubectl-run.png b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/kubectl-run.png new file mode 100644 index 0000000..f4295f2 Binary files /dev/null and b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/kubectl-run.png differ diff --git a/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/layers.png b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/layers.png similarity index 100% rename from k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/layers.png rename to k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/layers.png diff --git a/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/pod-container-node.png b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/pod-container-node.png new file mode 100644 index 0000000..c6c8fb6 Binary files /dev/null and b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/pod-container-node.png differ diff --git a/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/rc-pod-service.png b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/rc-pod-service.png new file mode 100644 index 0000000..c1e89f2 Binary files /dev/null and b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/rc-pod-service.png differ diff --git a/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/replication-controller.png b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/replication-controller.png new file mode 100644 index 0000000..5b61a06 Binary files /dev/null and b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/docs/replication-controller.png differ diff --git a/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/rc.yaml b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/rc.yaml new file mode 100644 index 0000000..b657a8f --- /dev/null +++ b/k8s-in-action/overview/chapter-2-first-steps-with-docker-and-k8s/rc.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: ReplicationController +metadata: + name: kubia +spec: + replicas: 3 + selector: + app: kubia + template: + metadata: + labels: + app: kubia + spec: + containers: + - name: kubia + image: luksa/kubia + ports: + - containerPort: 8080 diff --git a/k8s-in-action/overview/overview.md b/k8s-in-action/overview/overview.md index 705d0f5..e69de29 100644 --- a/k8s-in-action/overview/overview.md +++ b/k8s-in-action/overview/overview.md @@ -1,4 +0,0 @@ -# Part 1. Overview - -- [Chapter 1. Introducing Kubernetes](./chapter-1-introducing-kubernetes/chapter-1-introducing-kubernetes.md) -- [Chapter 2. First steps with Docker and Kubernetes](./chapter-2-first-steps-with-docker-and-k8s/chapter-2-first-steps-with-docker-and-k8s.md)