Bug 1508370
| Summary: | volume used by MongoDB pod is attached to another instance and is stuck | ||||||
|---|---|---|---|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | fredazom | ||||
| Component: | openshift-controller-manager | Assignee: | Michal Fojtik <mfojtik> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | zhou ying <yinzhou> | ||||
| Severity: | low | Docs Contact: | |||||
| Priority: | low | ||||||
| Version: | unspecified | CC: | aos-bugs, fredazom | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2019-08-23 12:59:39 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
Can you paste your deployment config? You have to use the recreate strategy if you have RWO PVC. I run the following command to deploy:
oc new-app --file=config_file.json -n tes29 -p DATABASE_USER=user -p DATABASE_PASSWORD=pwd -p DATABASE_NAME=dbname -p DATABASE_ADMIN_PASSWORD=admpwd.
config_file.json:
{
"kind": "Template",
"apiVersion": "v1",
"metadata": {
"name": "nodejs-mongo-persistent",
"creationTimestamp": null,
"annotations": {
"description": "An example Node.js application with a MongoDB database. For more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.",
"iconClass": "icon-nodejs",
"openshift.io/display-name": "Node.js + MongoDB (Persistent)",
"tags": "quickstart,nodejs",
"template.openshift.io/documentation-url": "https://github.com/openshift/nodejs-ex",
"template.openshift.io/long-description": "This template defines resources needed to develop a NodeJS application, including a build configuration, application deployment configuration, and database deployment configuration.",
"template.openshift.io/provider-display-name": "Red Hat, Inc.",
"template.openshift.io/support-url": "https://access.redhat.com"
}
},
"message": "The following service(s) have been created in your project: ${NAME}, ${DATABASE_SERVICE_NAME}.\n\nFor more information about using this template, including OpenShift considerations, see https://github.com/openshift/nodejs-ex/blob/master/README.md.",
"objects": [
{
"apiVersion": "v1",
"kind": "DeploymentConfig",
"metadata": {
"annotations": {
"description": "Defines how to deploy the database",
"template.alpha.openshift.io/wait-for-ready": "true"
},
"name": "${DATABASE_SERVICE_NAME}"
},
"spec": {
"replicas": 1,
"selector": {
"name": "${DATABASE_SERVICE_NAME}"
},
"strategy": {
"type": "Recreate"
},
"template": {
"metadata": {
"labels": {
"name": "${DATABASE_SERVICE_NAME}"
},
"name": "${DATABASE_SERVICE_NAME}"
},
"spec": {
"containers": [
{
"env": [
{
"name": "MONGODB_USER",
"valueFrom": {
"secretKeyRef": {
"key": "database-user",
"name": "${NAME}"
}
}
},
{
"name": "MONGODB_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"key": "database-password",
"name": "${NAME}"
}
}
},
{
"name": "MONGODB_DATABASE",
"value": "${DATABASE_NAME}"
},
{
"name": "MONGODB_ADMIN_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"key": "database-admin-password",
"name": "${NAME}"
}
}
}
],
"image": " ",
"livenessProbe": {
"initialDelaySeconds": 30,
"tcpSocket": {
"port": 27017
},
"timeoutSeconds": 1
},
"name": "mongodb",
"ports": [
{
"containerPort": 27017
}
],
"readinessProbe": {
"exec": {
"command": [
"/bin/sh",
"-i",
"-c",
"mongo 127.0.0.1:27017/$MONGODB_DATABASE -u $MONGODB_USER -p $MONGODB_PASSWORD --eval=\"quit()\""
]
},
"initialDelaySeconds": 3,
"timeoutSeconds": 1
},
"resources": {
"limits": {
"memory": "${MEMORY_MONGODB_LIMIT}"
}
},
"volumeMounts": [
{
"mountPath": "/var/lib/mongodb/data",
"name": "${DATABASE_SERVICE_NAME}-data"
}
]
}
],
"volumes": [
{
"name": "${DATABASE_SERVICE_NAME}-data",
"persistentVolumeClaim": {
"claimName": "${DATABASE_SERVICE_NAME}"
}
}
]
}
},
"triggers": [
{
"imageChangeParams": {
"automatic": true,
"containerNames": [
"mongodb"
],
"from": {
"kind": "ImageStreamTag",
"name": "mongodb:2.4",
"namespace": "${NAMESPACE}"
}
},
"type": "ImageChange"
},
{
"type": "ConfigChange"
}
]
}
}
],
"parameters": [
{
"name": "NAME",
"displayName": "Name",
"description": "The name assigned to all of the frontend objects defined in this template.",
"value": "nodejs-mongo-persistent",
"required": true
},
{
"name": "NAMESPACE",
"displayName": "Namespace",
"description": "The OpenShift Namespace where the ImageStream resides.",
"value": "openshift",
"required": true
},
{
"name": "MEMORY_LIMIT",
"displayName": "Memory Limit",
"description": "Maximum amount of memory the Node.js container can use.",
"value": "256Mi",
"required": true
},
{
"name": "MEMORY_MONGODB_LIMIT",
"displayName": "Memory Limit (MongoDB)",
"description": "Maximum amount of memory the MongoDB container can use.",
"value": "512Mi",
"required": true
},
{
"name": "VOLUME_CAPACITY",
"displayName": "Volume Capacity",
"description": "Volume space available for data, e.g. 512Mi, 2Gi",
"value": "1Gi",
"required": true
},
{
"name": "SOURCE_REPOSITORY_URL",
"displayName": "Git Repository URL",
"description": "The URL of the repository with your application source code.",
"value": "https://github.com/fredazom/amijardin",
"required": true
},
{
"name": "SOURCE_REPOSITORY_REF",
"displayName": "Git Reference",
"description": "Set this to a branch name, tag or other ref of your repository if you are not using the default branch."
},
{
"name": "CONTEXT_DIR",
"displayName": "Context Directory",
"description": "Set this to the relative path to your project if it is not in the root of your repository."
},
{
"name": "APPLICATION_DOMAIN",
"displayName": "Application Hostname",
"description": "The exposed hostname that will route to the Node.js service, if left blank a value will be defaulted."
},
{
"name": "GITHUB_WEBHOOK_SECRET",
"displayName": "GitHub Webhook Secret",
"description": "Github trigger secret. A difficult to guess string encoded as part of the webhook URL. Not encrypted.",
"generate": "expression",
"from": "[a-zA-Z0-9]{40}"
},
{
"name": "GENERIC_WEBHOOK_SECRET",
"displayName": "Generic Webhook Secret",
"description": "A secret string used to configure the Generic webhook.",
"generate": "expression",
"from": "[a-zA-Z0-9]{40}"
},
{
"name": "DATABASE_SERVICE_NAME",
"displayName": "Database Service Name",
"value": "mongodb",
"required": true
},
{
"name": "DATABASE_USER",
"displayName": "MongoDB Username",
"description": "Username for MongoDB user that will be used for accessing the database.",
"generate": "expression",
"from": "user[A-Z0-9]{3}"
},
{
"name": "DATABASE_PASSWORD",
"displayName": "MongoDB Password",
"description": "Password for the MongoDB user.",
"generate": "expression",
"from": "[a-zA-Z0-9]{16}"
},
{
"name": "DATABASE_NAME",
"displayName": "Database Name",
"value": "sampledb",
"required": true
},
{
"name": "DATABASE_ADMIN_PASSWORD",
"displayName": "Database Administrator Password",
"description": "Password for the database admin user.",
"generate": "expression",
"from": "[a-zA-Z0-9]{16}"
},
{
"name": "NPM_MIRROR",
"displayName": "Custom NPM Mirror URL",
"description": "The custom NPM mirror URL"
}
],
"labels": {
"template": "nodejs-mongo-persistent"
}
}
|
Created attachment 1346395 [details] oc_get_events Description of problem: When I make a deployment of a mongoDB pod, the persistence volume is already allocated to a non existing instance. Version-Release number of selected component (if applicable): openshift online v3 How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: in log events: mongodb-2-bq0nr Pod Warning FailedMount attachdetach Failed to attach volume "pvc-fbd5e2b8-ab78-11e7-9eb0-122631632f42" on node "ip-172-31-49-230.ec2.internal" with: Error attaching EBS volume "vol-0c8c44d2860f5aa97" to instance "i-0f2f096c66b0b0c65": VolumeInUse: vol-0c8c44d2860f5aa97 is already attached to an instance status code: 400, request id: 4ce08c6a-8f39-4e43-b1b2-600c8bfda7bd. The volume is currently attached to instance "i-01b834b553faaff9e" mongodb-2-bq0nr Pod Warning FailedMount attachdetach Failed to attach volume "pvc-fbd5e2b8-ab78-11e7-9eb0-122631632f42" on node "ip-172-31-49-230.ec2.internal" with: Error attaching EBS volume "vol-0c8c44d2860f5aa97" to instance "i-0f2f096c66b0b0c65": RequestLimitExceeded: Request limit exceeded. Expected results: sync with pvc OK Additional info: cluster starter-us-east-1 oc get events file attached oc get pvc -o yaml : apiVersion: v1 items: - apiVersion: v1 kind: PersistentVolumeClaim metadata: annotations: openshift.io/generated-by: OpenShiftNewApp pv.kubernetes.io/bind-completed: "yes" pv.kubernetes.io/bound-by-controller: "yes" volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/aws-ebs creationTimestamp: 2017-10-07T16:02:56Z labels: app: nodejs-mongo-persistent template: nodejs-mongo-persistent name: mongodb namespace: tes29 resourceVersion: "1536945190" selfLink: /api/v1/namespaces/tes29/persistentvolumeclaims/mongodb uid: fbd5e2b8-ab78-11e7-9eb0-122631632f42 spec: accessModes: - ReadWriteOnce resources: requests: storage: 1Gi storageClassName: ebs volumeName: pvc-fbd5e2b8-ab78-11e7-9eb0-122631632f42 status: accessModes: - ReadWriteOnce capacity: storage: 1Gi phase: Bound kind: List metadata: {} resourceVersion: "" selfLink: ""