Files
2025-12-25 00:05:18 +08:00

62 lines
1.2 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-world
labels:
app: hello-world
spec:
selector:
matchLabels:
app: hello-world
template:
metadata:
labels:
app: hello-world
spec:
nodeSelector:
machine: aliyun
containers:
- name: hello
image: docker.cnb.cool/kevisual/hello
ports:
- containerPort: 80
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
name: hello-world
labels:
app: hello-world
spec:
selector:
app: hello-world
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 30081
type: NodePort
# http://121.199.37.154:30081/
# 1.查看 Deployment 状态:
# kubectl get deployment hello-world
# kubectl logs deployment/hello-world
# 2. 查看 Pod 状态:
# kubectl get pods -l app=hello-world
# 3.查看 Pod 详细信息(包括事件):
# kubectl describe pod -l app=hello-world
# 4. delete all
# kubectl delete -f hello.yaml
# 5. delete pod
# kubectl delete pod -l app=hello-world
# 6. rollupdate
# kubectl set image deployment/hello-world hello=docker.cnb.cool/kevisual/hello:latest
# 7. 进入 Pod
# kubectl exec -it deployment/hello-world -- /bin/sh