Kubernetes 101 - Containers

Kubernetes 101 - Containers

Chris Bongers
Β·Nov 2, 2022Β·

2 min read

Play this article

For this article we'll be looking a bit more in detail into containers. Containers are ready to run software packages, meaning they include everything:

  • code
  • runtime if required
  • application
  • system libraries

Once something is converted into a container the code cannot change, if you need to update any of the above mentioned elements you'll need to create a new image version.

The benefit of these images containing everything out of the box is that the can easily run on different OS environments and clouds.

Container images

As for the container images it references a bundles application that you can run on a given pod.

So where do these images live?

By default Kubernetes will look in the Docker registry for your images based on it's name. However it's possible to use other registries as well as private hosted ones.

We won't go into too much detail around this for now.

The main thing here is to know that at some point we'll have to convert our code into a image and push it somewhere.

Container hooks

Hooks are not a new concept, but something worth mentioning. Our containers come with some hooks exposed, there are two exposed ones:

  • PostStart: Executed immediately after creation of the container.
  • PreStop: Called before the container is terminated due to unhealthiness of controller decided to kill it off. It's important to note the container will always be killed, it won't wait for some calls to happen in this hook.

For our beginning exploration of Kubernetes we won't use these hooks just yet, so let's dive into them at a later stage again.

Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on Facebook or Twitter

Did you find this article valuable?

Support Chris Bongers by becoming a sponsor. Any amount is appreciated!

See recent sponsors |Β Learn more about Hashnode Sponsors
Β 
Share this