Skip to content

Commit

Permalink
add docker desktop (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakamasato authored Sep 30, 2023
1 parent bf371ff commit 9a6cd28
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions contents/local-cluster/docker-desktop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Docker Desktop

Load Balancer in Kubernetes in Docker Desktop (ref: https://www.docker.com/blog/how-kubernetes-works-under-the-hood-with-docker-desktop/)

```
ubectl apply -f - <<EOF
apiVersion: v1
kind: Service
metadata:
name: tutorial
spec:
ports:
- name: 80-tcp
port: 80
protocol: TCP
targetPort: 80
selector:
com.docker.project: tutorial
type: LoadBalancer
status:
loadBalancer: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
com.docker.project: tutorial
name: tutorial
spec:
replicas: 1
selector:
matchLabels:
com.docker.project: tutorial
strategy:
type: Recreate
template:
metadata:
labels:
com.docker.project: tutorial
spec:
containers:
- image: docker/getting-started
name: tutorial
ports:
- containerPort: 80
protocol: TCP
resources: {}
restartPolicy: Always
status: {}
EOF
```

```
kubectl get svc tutorial
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
tutorial LoadBalancer 10.105.129.171 localhost 80:32088/TCP 2m
```

http://localhost/tutorial/

![](docker-tutorial.png)

```
kubectl delete svc tutorial
kubectl delete deploy tutorial
```
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9a6cd28

Please sign in to comment.