1、创建YAML文件
$ vim ng-deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: myng
name: ng-deploy
namespace: aming
spec:
replicas: 2 ##副本数
selector:
matchLabels:
app: myng
template:
metadata:
labels:
app: myng
spec:
containers:
- name: myng
image: nginx:1.21.6
ports:
- name: myng-port
containerPort: 80
2、使用YAML创建deploy
$ k apply -f ng-deploy.yaml
3、查看
$ k get deploy,po -n aming
4、查看pod分配到哪个节点上
$ k get po -o wide
5、恢复
$ k delete -f ng-deploy.yaml