2025-02-07 08:07:04 +11:00
..
2025-02-07 08:07:04 +11:00
2025-02-07 08:07:04 +11:00

Introduction to Kubernetes: Services

k8s-services

Create a Kubernetes cluster

Firstly, we will need a Kubernetes cluster and will create one using kind

kind create cluster --name services --image kindest/node:v1.31.1

Test the cluster

kubectl get nodes
NAME                     STATUS   ROLES           AGE     VERSION
services-control-plane   Ready    control-plane   5m48s   v1.31.1

Deploy a few pods

Let's deploy a few pods using a Kubernetes Deployment. To understand services, we need to deploy some pods that become our "upstream" or "endpoint" that we want to access.

kubectl apply -f kubernetes/deployments/deployment.yaml 

Deploy a service

We can now deploy a Kubernetes service that targets our deployment:

kubectl apply -f kubernetes/services/service.yaml