K8S创建Deployment报错(汇总)
K8S创建Deployment报错误
·
1.error: unable to recognize "httpd.yml": no matches for kind "Deployment" in version "apps/v1beta1"
此错误是由于K8S版本原因,我使用的版本是1.23.5,此版本已经弃用apps/v1beta1
原配置
apiVersion: extensions/v1beta1
kind: Deployment
修改为
apiVersion: apps/v1
kind: Deployment
2.error: error validating "httpd.yml": error validating data: ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec
缺少必备参数selector
修改后配置如下
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd
spec:
replicas: 2
selector:
matchLabels:
app: httpd
template:
metadata:
labels:
app: httpd
spec:
containers:
- name: httpd
image: httpd
ports:
- containerPort: 80
更多推荐
已为社区贡献2条内容
所有评论(0)