Skip to content

Instantly share code, notes, and snippets.

@gowatana

gowatana/game-2048.yml

Last active Dec 13, 2020
Embed
What would you like to do?
Kubernetesで2048。
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: dep-game2048
spec:
replicas: 1
selector:
matchLabels:
run: game2048
template:
metadata:
labels:
run: game2048
spec:
containers:
- name: game2048
image: gowatana/docker-2048
ports:
- containerPort: 80
protocol: TCP
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: svc-2048
spec:
type: NodePort
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
run: game2048
@gowatana

This comment has been minimized.

Copy link
Owner Author

@gowatana gowatana commented Aug 29, 2019

ネームスペース作成。

karbon$ kubectl create ns test01
namespace/test01 created

2048をデプロイ。

karbon$ kubectl apply -f game-2048.yml -n test01
deployment.apps/dep-game2048 created
service/svc-2048 created

NodePort確認。例では31031

karbon$ kubectl get svc svc-2048 -n test01
NAME       TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
svc-2048   NodePort   172.19.208.102   <none>        80:31031/TCP   17s

WorkerノードのIPアドレスの確認。

karbon$ kubectl describe nodes | grep InternalIP
@gowatana

This comment has been minimized.

Copy link
Owner Author

@gowatana gowatana commented Aug 29, 2019

削除。

karbon$ kubectl delete ns test01
namespace "test01" deleted
@gowatana

This comment has been minimized.

Copy link
Owner Author

@gowatana gowatana commented Dec 13, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment