Kuberneted配置 - 容器没有部署的资源请求
我在Gitlab中的Kubernetes配置挣扎。
我正在研究某人像一年前一样配置的项目,项目具有后端和前端部分,我想在应用程序配置中更新密码。不幸的是,在使用GitLab配置部署后,以前的开发人员离开了,似乎没有部署新版本的代码,并且应用程序仍在使用旧密码。试图在代码中进行一些其他更改,例如通过Liquibase添加新表,并且此问题仍然发生,部署后没有创建表。
运输应用程序中的所有对象,它用于后端部分,POD,Service,deployment.Apps for Backend。
secret/regcred-dashboard unchanged
service/IE599-dashboard created
ingress.extensions/IE599-dashboard configured
Error from server ([denied by k8sresourcesrequestandatory] container <IE599-dashboard> has no resource requests for deployment <IE599-dashboard>): error when creating "STDIN": admission webhook "validation.gatekeeper.sh" denied the request: [denied by k8sresourcesrequestandatory] container <IE599-dashboard> has no resource requests for deployment <IE599-dashboard>
我决定删除DEV名称空间和重新 对Kubernetes没有任何经验,我现在不知道怎么了。
使用以下gitlab配置
deploy to dev:
extends:
- .deployment
- .dev
stage: dev
before_script:
- export CI_ENV=dev
when: manual
.deployment:
dependencies:
- containerize
extends:
- .k8s
script:
- envsubst < ./kubernetes/${CI_ENV}/deployment.yaml | kubectl apply -n IE599-${CI_ENV} -f -
apiVersion: v1
kind: Secret
metadata:
name: regcred-dashboard
namespace: IE599-dev
data:
.dockerconfigjson:
type: kubernetes.io/dockerconfigjson
---
apiVersion: v1
kind: Service
metadata:
name: IE599-dashboard
namespace: IE599-dev
spec:
ports:
- port: 8080
selector:
app: IE599-dashboard
type: ClusterIP
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: IE599-dashboard
namespace: IE599-dev
labels:
app: IE599-dashboard
service: IE599-dashboard
spec:
rules:
- host: IE599-dev.app.com
http:
paths:
- backend:
serviceName: IE599-dashboard
servicePort: 8080
path: /
tls:
- hosts:
- IE599-dev.app.com
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: IE599-dashboard
namespace: IE599-dev
labels:
app: IE599-dashboard
spec:
replicas: 1
selector:
matchLabels:
app: IE599-dashboard
template:
metadata:
labels:
app: IE599-dashboard
spec:
containers:
- env:
- name: API_URL
value: https://IE599-api-dev.app.com/api
name: IE599-dashboard
image: registry.app.com/IE599/IE599-dashboard:$CI_COMMIT_SHORT_SHA
imagePullPolicy: Always
resources:
limits:
cpu: '100m'
memory: 256Mi
securityContext:
runAsNonRoot: true
runAsUser: 1000
imagePullSecrets:
- name: regcred-dashboard
不确定为什么它不起作用,我会在这里感谢任何帮助。
I'm struggling with Kubernetes configuration in GitLab.
I'm working on project that someone configured like year ago, project has backend and frontend part and I wanted to update password in application configuration. Unfortunately after deploying using GitLab configuration that previous developer left it seems like new version of code was not deployed and application is still using old password. Tried to make some additional changes in code like adding new table through liquibase and this problem still occurred, no table was created after deploying.
I've decided to delete all objects in dev namespace and redeploy application, it worked for backend part, pod, service, deployment.apps for backend were created but while I'm trying to deploy frontend part I'm getting following error
secret/regcred-dashboard unchanged
service/IE599-dashboard created
ingress.extensions/IE599-dashboard configured
Error from server ([denied by k8sresourcesrequestandatory] container <IE599-dashboard> has no resource requests for deployment <IE599-dashboard>): error when creating "STDIN": admission webhook "validation.gatekeeper.sh" denied the request: [denied by k8sresourcesrequestandatory] container <IE599-dashboard> has no resource requests for deployment <IE599-dashboard>
Unfortunately I don't have any experience with Kubernetes and I don't know what's wrong now.
Using following GitLab configuration
deploy to dev:
extends:
- .deployment
- .dev
stage: dev
before_script:
- export CI_ENV=dev
when: manual
.deployment:
dependencies:
- containerize
extends:
- .k8s
script:
- envsubst < ./kubernetes/${CI_ENV}/deployment.yaml | kubectl apply -n IE599-${CI_ENV} -f -
apiVersion: v1
kind: Secret
metadata:
name: regcred-dashboard
namespace: IE599-dev
data:
.dockerconfigjson:
type: kubernetes.io/dockerconfigjson
---
apiVersion: v1
kind: Service
metadata:
name: IE599-dashboard
namespace: IE599-dev
spec:
ports:
- port: 8080
selector:
app: IE599-dashboard
type: ClusterIP
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: IE599-dashboard
namespace: IE599-dev
labels:
app: IE599-dashboard
service: IE599-dashboard
spec:
rules:
- host: IE599-dev.app.com
http:
paths:
- backend:
serviceName: IE599-dashboard
servicePort: 8080
path: /
tls:
- hosts:
- IE599-dev.app.com
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: IE599-dashboard
namespace: IE599-dev
labels:
app: IE599-dashboard
spec:
replicas: 1
selector:
matchLabels:
app: IE599-dashboard
template:
metadata:
labels:
app: IE599-dashboard
spec:
containers:
- env:
- name: API_URL
value: https://IE599-api-dev.app.com/api
name: IE599-dashboard
image: registry.app.com/IE599/IE599-dashboard:$CI_COMMIT_SHORT_SHA
imagePullPolicy: Always
resources:
limits:
cpu: '100m'
memory: 256Mi
securityContext:
runAsNonRoot: true
runAsUser: 1000
imagePullSecrets:
- name: regcred-dashboard
Not sure why it's not working, I'll appreciate any help here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在部署中,您将
其更新为:
您遇到的错误(
没有部署的资源请求&lt; ie599-dashboard&gt;
)是K8的告诉您,您在部署中没有资源请求。In your deployment you have
Update that to:
The error you're getting (
has no resource requests for deployment <IE599-dashboard>
) is k8's telling you that that you dont have resource requests in your deployment.