Comments (3)
@dgarciabriseno with the following docker-compose.yml I couldn't reproduce the issue:
version: '3.8'
services:
mongodb:
image: mongo:latest
restart: always
expose:
- 27017
secrets:
- config-ini
secrets:
config-ini:
file: secrets/Config.ini
The created secret and deployment are created as expected without any problem. Apart from that if you need to use Subpath you can use the label kompose.volume.subpath
.
You can provide us with your docker-compose file for further help.
from kompose.
Sorry I was unresponsive, I hadn't worked on getting my compose project into kubernetes in a while. It looks like you guys may have found the issue since there's an open PR.
Here's an actual kubernetes deployment that shows the issue:
deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert -f ../compose.prod.yaml
kompose.version: 1.31.2 (HEAD)
creationTimestamp: null
labels:
io.kompose.service: database
name: database
spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: database
strategy: {}
template:
metadata:
annotations:
kompose.cmd: kompose convert -f ../compose.prod.yaml
kompose.version: 1.31.2 (HEAD)
creationTimestamp: null
labels:
io.kompose.network/project-default: "true"
io.kompose.service: database
spec:
containers:
- env:
- name: MARIADB_ROOT_PASSWORD_FILE
value: /run/secrets/mariadb-password
image: mariadb:11
livenessProbe:
exec:
command:
- bash
- /usr/local/bin/healthcheck.sh
- --connect
failureThreshold: 3
periodSeconds: 5
timeoutSeconds: 5
name: database
resources: {}
volumeMounts:
- mountPath: /run/secrets/mariadb-password
name: mariadb-password
restartPolicy: Always
volumes:
- name: mariadb-password
secret:
items:
- key: mariadb-password
path: mariadb-password
secretName: mariadb-password
status: {}
And password secret:
apiVersion: v1
data:
mariadb-password: Zm9yLWtvbXBvc2UtdGVzdGluZwo=
kind: Secret
metadata:
creationTimestamp: null
labels:
io.kompose.service: mariadb-password
name: mariadb-password
type: Opaque
Put these in a folder and run:
$ kubectl apply -f .
deployment.apps/database created
secret/mariadb-password created
And I get this result:
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
database-9cd769646-52gd4 0/1 CrashLoopBackOff 2 (16s ago) 32s
$ kubectl logs database-9cd769646-52gd4
2024-02-09 19:56:49+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.2.2+maria~ubu2204 started.
Kind of weird that the error doesn't show up saying I'm missing the environment variable for the password.
But then if I edit volume mounts to include the subPath:
volumeMounts:
- mountPath: /run/secrets/mariadb-password
subPath: mariadb-password
name: mariadb-password
And reapply with kubectl apply -f .
Then all is good.
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
database-5955d99cb4-mpscc 1/1 Running 0 27s
from kompose.
updated fix to contemplate mays in secrets:
version: "3.9"
services:
database:
image: mariadb:11
deploy:
replicas: 1
environment:
MARIADB_ROOT_PASSWORD_FILE: /run/secrets/MARIADB_PASSWORD
secrets:
- MARIADB_PASSWORD
secrets:
MARIADB_PASSWORD:
file: "./mariadb-password.txt"
from kompose.
Related Issues (20)
- Add label for initContainers HOT 3
- [BUG] Updated doc installation.md HOT 4
- run-kompose pre-commit hook HOT 2
- Request for migration to community infrastrucuture! HOT 4
- Automate release process. HOT 2
- Kubernetes-Security-Slam-2023 HOT 3
- the image used in the https://kompose.io/user-guide/ is broken & has to be replaced HOT 1
- [BUG] Conflicting name assigned to configmap generated for compose referencing ".env" files HOT 2
- Create ConfigMaps automatically from existing docker-compose volume mounts. HOT 2
- Add Labels for CronJob HOT 1
- docker-compose to k8s HOT 2
- Consolidate filenames in tests from docker-compose[.*].y[a]ml to compose[.*].yaml
- [BUG] fail to convert example HOT 6
- Website does not have the correct trademark disclaimer
- [BUG] Kompose Client can't create pods / cronjobs
- [BUG] Bump Alpine HOT 2
- [BUG] Update README.md doc HOT 7
- [BUG] Creating ConfigMaps from volume mounts in windows is unsuccessful when the working directory is specified as an absolute path.
- [BUG] Creating ConfigMaps from volume mounts with CRLF characters should be converted as text and not binary.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kompose.