1.编写yaml文件
apiVersion: apps/v1
kind: Deployment
metadata:
name: dev-nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: dev-nginx-deployment
template:
metadata:
labels:
app: dev-nginx-deployment
spec:
containers:
- name: nginx
image: nginx:1.19.5
2.应用yaml文件
kubectl apply -f dev-nginx.yml
3.查看deployment
kubectl get deployment
4.deployment扩缩容
kubectl scale --replicas=0 deployment/dev-nginx-deployment
5.创建Service
apiVersion: v1
kind: Service
metadata:
name: nginx-svc
spec:
selector:
app: dev-nginx-deployment
ports:
- protocol: TCP
port: 8080
targetPort: 80
1.查看pod部署详细信息
kubectl describe pod dev-nginx
2.查看pod部署简要信息
kubectl get pod -o wide
3.复制网络配置
如果run/flannel下没有subnet.env文件则需要从master复制该配置文件
scp -r subnet.env 192.168.221.129:/run/flannel/
4.手动下载镜像并打标
docker pull ggangelo/pause:3.2
docker pull ggangelo/kube-proxy:v1.19.4
docker tag ggangelo/pause:3.2 k8s.gcr.io/pause:3.2
docker tag ggangelo/kube-proxy:v1.19.4 k8s.gcr.io/kube-proxy:v1.19.4