mirror of
https://github.com/marcel-dempers/docker-development-youtube-series.git
synced 2025-06-06 17:01:30 +00:00
Merge pull request #250 from marcel-dempers/service
update k8s services guide
This commit is contained in:
commit
c78e6701e3
@ -1,3 +1,36 @@
|
|||||||
# Introduction to Kubernetes: Services
|
# Introduction to Kubernetes: Services
|
||||||
|
|
||||||
<a href="https://youtu.be/xhva6DeKqVU" title="k8s-services"><img src="https://i.ytimg.com/vi/xhva6DeKqVU/hqdefault.jpg" width="20%" alt="k8s-services" /></a>
|
<a href="https://youtu.be/hiiiGLnPdq4" title="k8s-services"><img src="https://i.ytimg.com/vi/hiiiGLnPdq4/hqdefault.jpg" width="20%" alt="k8s-services" /></a>
|
||||||
|
|
||||||
|
## Create a Kubernetes cluster
|
||||||
|
|
||||||
|
Firstly, we will need a Kubernetes cluster and will create one using [kind](https://kind.sigs.k8s.io/)
|
||||||
|
|
||||||
|
```
|
||||||
|
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. </br>
|
||||||
|
|
||||||
|
```
|
||||||
|
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
|
||||||
|
```
|
@ -5,7 +5,7 @@ metadata:
|
|||||||
labels:
|
labels:
|
||||||
app: example-app
|
app: example-app
|
||||||
spec:
|
spec:
|
||||||
type: LoadBalancer
|
type: ClusterIP
|
||||||
selector:
|
selector:
|
||||||
app: example-app
|
app: example-app
|
||||||
ports:
|
ports:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user