gpt4 book ai didi

laravel - kubernetes上的snipeit未运行

转载 作者:行者123 更新时间:2023-12-02 12:18:01 25 4
gpt4 key购买 nike

我正在尝试在k8s集群上部署snipe-it

我已经在kubernetes上运行mysql

我想在kubernetes上部署snipe-it应用程序

我的yaml文件就像

apiVersion: v1
kind: Service
metadata:
name: snipeit
labels:
app: snipeit
spec:
ports:
- port: 80
selector:
app: snipeit
tier: frontend
type: LoadBalancer
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: snipeit-pv-claim
labels:
app: snipeit
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: snipeit
labels:
app: snipeit
spec:
selector:
matchLabels:
app: snipeit
tier: frontend
strategy:
type: Recreate
template:
metadata:
labels:
app: snipeit
tier: frontend
spec:
containers:
- image: snipe/snipe-it
name: snipeit
env:
- name: DB_CONNECTION
value: mysql
- name: DB_HOST
value: mysql
- name: DB_USERNAME
value: root
- name: DB_DATABASE
value: snipeit
- name: APP_URL
value: url
- name: DB_PASSWORD
value: password
ports:
- containerPort: 80
name: snipeit
volumeMounts:
- name: snipeit-persistent-storage
mountPath: /var/www/html
volumes:
- name: snipeit-persistent-storage
persistentVolumeClaim:
claimName: snipeit-pv-claim

这不起作用

我正在使用的图像来自docker hub:
https://hub.docker.com/r/snipe/snipe-it

github snipe-it: https://github.com/snipe/snipe-it
容器开始运行,但是我登录到容器内部并检查var / www / html但那里没有内容

最佳答案

apiVersion: v1
kind: ConfigMap
metadata:
name: snipe-it-config
data:
# Mysql Parameters
MYSQL_PORT_3306_TCP_ADDR: "address"
MYSQL_PORT_3306_TCP_PORT: "3306"
MYSQL_DATABASE: "snipeit"
MYSQL_USER: "user"
MYSQL_PASSWORD: "pass"

# Email Parameters
# - the hostname/IP address of your mailserver
MAIL_PORT_587_TCP_ADDR: "<smtp-host>"
#the port for the mailserver (probably 587, could be another)
MAIL_PORT_587_TCP_PORT: "587"
# the default from address, and from name for emails
MAIL_ENV_FROM_ADDR: "noreply@mydomain.com"
MAIL_ENV_FROM_NAME: "Snipe-IT"
# - pick 'tls' for SMTP-over-SSL, 'tcp' for unencrypted
MAIL_ENV_ENCRYPTION: "tls"
# SMTP username and password
MAIL_ENV_USERNAME: "<smtp-username>"
MAIL_ENV_PASSWORD: "<smtp-password>"

# Snipe-IT Settings
APP_ENV: "production"
APP_DEBUG: "false"
APP_KEY: "key"
APP_URL: "http://127.0.0.1:80"
APP_TIMEZONE: "Asia/Kolkata"
APP_LOCALE: "en"
---
apiVersion: v1
kind: Service
metadata:
name: snipeit
labels:
app: snipeit
spec:
ports:
- port: 80
selector:
app: snipeit
tier: frontend
type: LoadBalancer
---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: snipeit
labels:
app: snipeit
spec:
selector:
matchLabels:
app: snipeit
tier: frontend
strategy:
type: Recreate
template:
metadata:
labels:
app: snipeit
tier: frontend
spec:
containers:
- image: snipe/snipe-it
name: snipeit
envFrom:
- configMapRef:
name: snipe-it-config
ports:
- containerPort: 80
name: snipeit
volumeMounts:
- name: snipeit-persistent-storage
mountPath: /var/lib/snipeit
volumes:
- name: snipeit-persistent-storage
persistentVolumeClaim:
claimName: snipeit-pv-claim
而不是使用configmap,我在部署部分添加了环境变量和参数...所以只是添加了config map并使其顺利启动并运行

关于laravel - kubernetes上的snipeit未运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54233992/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com