kubernetes1.5版本deployment部署的apiVersion为extensions/v1beta1 ,yml脚本如下:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: test-service-deploy
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
1.6.0版本中的apiVersion写法为apps/v1beta1
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: test-service-deploy
labels:
app: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
目前官网的apiVersion:为apps/v1,yml脚本如下:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
apiVersion内容不对会导致创建时报错,无法正常创建。