Initial commit: k3s deployment configurations
This commit is contained in:
62
k3s/nav/nav-config.yaml
Normal file
62
k3s/nav/nav-config.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: navigation
|
||||
|
||||
---
|
||||
|
||||
# ▼▼▼ 核心知识点:ConfigMap ▼▼▼
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: homepage-config
|
||||
namespace: navigation
|
||||
data:
|
||||
# 配置文件 1: 定义小组件 (显示时间、搜索框、资源占用)
|
||||
widgets.yaml: |
|
||||
- search:
|
||||
provider: google
|
||||
target: _blank
|
||||
- resources:
|
||||
cpu: true
|
||||
memory: true
|
||||
disk: true
|
||||
- datetime:
|
||||
text_size: xl
|
||||
format:
|
||||
timeStyle: short
|
||||
|
||||
# 配置文件 2: 定义您的服务链接 (请注意看下面的 icon 和 href)
|
||||
services.yaml: |
|
||||
- 我的应用:
|
||||
- 个人博客:
|
||||
icon: wordpress.png
|
||||
href: https://blog.u9.net3w.com
|
||||
description: 我的数字花园
|
||||
- 远程桌面:
|
||||
icon: linux.png
|
||||
href: https://wt.u9.net3w.com
|
||||
description: K8s 外部反代测试
|
||||
|
||||
- 基础设施:
|
||||
- 状态监控:
|
||||
icon: uptime-kuma.png
|
||||
href: https://status.u9.net3w.com
|
||||
description: Uptime Kuma
|
||||
widget:
|
||||
type: uptimekuma
|
||||
url: http://kuma-service.monitoring.svc.cluster.local # ▼ 重点:K8s 内部 DNS
|
||||
slug: my-wordpress-blog # (高级玩法:稍后填这个)
|
||||
- 存储管理:
|
||||
icon: longhorn.png
|
||||
href: https://storage.u9.net3w.com
|
||||
description: 分布式存储面板
|
||||
widget:
|
||||
type: longhorn
|
||||
url: http://longhorn-frontend.longhorn-system.svc.cluster.local
|
||||
# 配置文件 3: 基础设置
|
||||
settings.yaml: |
|
||||
title: K3s 指挥中心
|
||||
background: https://images.unsplash.com/photo-1519681393784-d120267933ba?auto=format&fit=crop&w=1920&q=80
|
||||
theme: dark
|
||||
color: slate
|
||||
71
k3s/nav/nav-deploy.yaml
Normal file
71
k3s/nav/nav-deploy.yaml
Normal file
@@ -0,0 +1,71 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: homepage
|
||||
namespace: navigation
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: homepage
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: homepage
|
||||
spec:
|
||||
containers:
|
||||
- name: homepage
|
||||
image: ghcr.io/gethomepage/homepage:latest
|
||||
ports:
|
||||
- containerPort: 3000
|
||||
# ▼▼▼ 关键动作:把 ConfigMap 挂载成文件 ▼▼▼
|
||||
volumeMounts:
|
||||
- name: config-volume
|
||||
mountPath: /app/config # 容器里的配置目录
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: homepage-config # 引用上面的 ConfigMap
|
||||
|
||||
---
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: homepage-service
|
||||
namespace: navigation
|
||||
spec:
|
||||
selector:
|
||||
app: homepage
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
targetPort: 3000
|
||||
|
||||
---
|
||||
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: homepage-ingress
|
||||
namespace: navigation
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||
# 开启这个可以允许跨域调用 (可选)
|
||||
nginx.ingress.kubernetes.io/enable-cors: "true"
|
||||
spec:
|
||||
rules:
|
||||
- host: nav.u9.net3w.com # <--- 您的新域名
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: homepage-service
|
||||
port:
|
||||
number: 80
|
||||
tls:
|
||||
- hosts:
|
||||
- nav.u9.net3w.com
|
||||
secretName: nav-tls-secret
|
||||
Reference in New Issue
Block a user