Database Integration Testing with Testcontainers
Introduction to Testcontainers In this post we'll look at Testcontainers and how it can be used to spin up throwaway test databases for your integration tests. You'll see that Testcontainers offers an excellent alternative to in memory databases, such as H2. In memory databases have benefits in terms of speed [...]
CKAD Exam Tips & Tricks
I recently passed the CKAD exam and wanted to write up a few tips and tricks that I think other folk might find useful. The exam consists of a number of hands on questions or problems that have to be solved on the command line. This is the first [...]
CKAD Part17 – Volumes, PersistentVolumes & PersistentVolumeClaims
Kubernetes Volumes Internal container storage is ephemeral, which means that it exits only for the lifetime of the container. When the container is stopped any data written inside the container is lost. Volumes provide a means of storing data beyond the life of the container. The Pod definition below [...]
CKAD Prep Part 16 – Network Policies
Network Policies By default, a Pod can communicate with any other Pod in the same cluster. NetworkPolicies allow you to limit the network traffic allowed to and from Pods in the cluster. A sample NetworkPolicy is shown below. apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: sample-network-policy spec: podSelector: matchLabels: app: [...]
CKAD Prep Part 15 – Services
Kubernetes Services A Kubernetes Service object is an abstraction that provides network access to a dynamic set of Pod replicas. Rather than access Pods directly via their IPs, you can use a Service to proxy requests and deal with service discovery and load balancing. A Service usually uses a [...]
CKAD Prep Part 14 – Jobs & Cronjobs
Jobs & Cronjobs Jobs A Job is a Kubernetes object that executes a workload and then terminates once the workload is complete. When a Job finishes, the containers involved are terminated and the Pod transitions to the Completed state. Jobs and Pods are similar in that they're both used [...]
CKAD Prep Part 13 – Rolling Updates & Rollbacks
Rolling Updates & Rollbacks Rolling updates provide a mechanism for updating containers in a cluster without downtime. This powerful Kubernetes feature allows you to update containers while maintaining high availability. To see this in action we'll create a Deployment consisting of 3 nginx Pods using the definition below. Note [...]
CKAD Prep Part 12 – Deployments
Kubernetes Deployments A Kubernetes Deployment object provides a means of managing a group of Pod instances, known as replicas. The Deployment tells Kubernetes the type of Pod you want to run and the number of Pod instances. This is known as the desired state. Kubernetes will actively monitor the [...]
CKAD Prep Part 11 – Labels, Selectors & Annotations
Kubernetes - Labels, Selectors & Annotations Labels Labels are key/value pairs that are used to add metadata to Kubernetes objects. They can be used to select and group subsets of objects in the cluster. Labels are added to an object in the metadata.labels section of the object descriptor as [...]
CKAD Prep Part 10 – Kubernetes Liveness & Readiness Probes
Kubernetes Liveness & Readiness Probes Liveness Probe A Liveness probe indicates whether or not a container is healthy and is used by Kubernetes to determine when a container should be terminated and restarted. You define your own custom criteria for determining container health. For example, if your container is [...]