1.创建
kubectl create -f 我的配置文件
2.使用新版本镜像更新
kubectl replace -f nginx-deployment.yaml
3.根据标签查询对象
kubectl get pods -l app=nginx
4.kubectl apply 命令来统一进行 Kubernetes 对象的创建和更新操作
创建和更新均使用如下命令
kubectl apply -f nginx-deployment.yaml
5.查询pod的详细信息
kubectl describe pod nginx-deployment-67594d6bf6-9gdvr
6.一个基本的deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.8
ports:
- containerPort: 80
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: nginx-vol
volumes:
- name: nginx-vol
hostPath:
path: /var/data