Kubernetes 创建测试用 Deployment Service Pod
Kubernetes kubectl About 647 wordsyaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: my-ns
spec:
replicas: 1
selector:
matchLabels:
app: nginx-pod
template:
metadata:
labels:
app: nginx-pod
spec:
containers:
- name: nginx
image: nginx:1.25.3-alpine
---
apiVersion: v1
kind: Service
metadata:
name: nginx-service
namespace: my-ns
labels:
app: nginx
spec:
ports:
- port: 80
targetPort: 80
selector:
app: nginx-pod
创建
kubectl --kubeconfig /root/dev.yaml create -f /root/k8s-nginx.yaml
删除
kubectl --kubeconfig /root/dev.yaml delete -f /root/k8s-nginx.yaml
Views: 375 · Posted: 2024-08-06
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...