首次提交:初始化项目
This commit is contained in:
179
010-中间件/003-navigation/deployment.yaml
Normal file
179
010-中间件/003-navigation/deployment.yaml
Normal file
@@ -0,0 +1,179 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: navigation
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: navigation-html
|
||||
namespace: navigation
|
||||
data:
|
||||
index.html: |
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>K3s 服务导航</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 100vh;
|
||||
padding: 20px;
|
||||
}
|
||||
.container { max-width: 1200px; margin: 0 auto; }
|
||||
header { text-align: center; color: white; margin-bottom: 40px; padding: 40px 20px; }
|
||||
h1 { font-size: 3em; margin-bottom: 10px; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); }
|
||||
.subtitle { font-size: 1.2em; opacity: 0.9; }
|
||||
.services-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 20px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
.service-card {
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
padding: 25px;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
|
||||
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
display: block;
|
||||
}
|
||||
.service-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 15px 40px rgba(0,0,0,0.3);
|
||||
}
|
||||
.service-icon { font-size: 3em; margin-bottom: 15px; }
|
||||
.service-name { font-size: 1.5em; font-weight: bold; margin-bottom: 10px; color: #333; }
|
||||
.service-url { color: #667eea; font-size: 0.9em; word-break: break-all; }
|
||||
.service-description { color: #666; margin-top: 10px; font-size: 0.9em; }
|
||||
footer { text-align: center; color: white; padding: 20px; opacity: 0.8; }
|
||||
.update-time {
|
||||
background: rgba(255,255,255,0.2);
|
||||
padding: 10px 20px;
|
||||
border-radius: 20px;
|
||||
display: inline-block;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.stats { background: rgba(255,255,255,0.1); padding: 15px; border-radius: 10px; margin-top: 20px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<header>
|
||||
<h1>🚀 K3s 服务导航</h1>
|
||||
<p class="subtitle">快速访问您的所有服务</p>
|
||||
</header>
|
||||
<div class="services-grid" id="services"></div>
|
||||
<footer>
|
||||
<div class="stats" id="stats">加载中...</div>
|
||||
<div class="update-time">最后更新: <span id="updateTime">-</span></div>
|
||||
</footer>
|
||||
</div>
|
||||
<script>
|
||||
const services = [
|
||||
{ name: 'Longhorn', icon: '💾', url: 'https://longhorn.u6.net3w.com', description: '分布式块存储管理' },
|
||||
{ name: 'Grafana', icon: '📊', url: 'https://grafana.u6.net3w.com', description: '监控数据可视化' },
|
||||
{ name: 'Prometheus', icon: '📈', url: 'https://prometheus.u6.net3w.com', description: '指标监控系统' },
|
||||
{ name: 'Alertmanager', icon: '🔔', url: 'https://alertmanager.u6.net3w.com', description: '告警管理系统' },
|
||||
{ name: 'MinIO S3', icon: '🗄️', url: 'https://s3.u6.net3w.com', description: '对象存储 API' },
|
||||
{ name: 'MinIO Console', icon: '🎛️', url: 'https://console.s3.u6.net3w.com', description: 'MinIO 管理控制台' },
|
||||
{ name: '测试页面', icon: '🧪', url: 'https://test.u6.net3w.com', description: '测试服务' }
|
||||
];
|
||||
|
||||
function renderServices() {
|
||||
const container = document.getElementById('services');
|
||||
container.innerHTML = services.map(service => `
|
||||
<a href="${service.url}" class="service-card" target="_blank">
|
||||
<div class="service-icon">${service.icon}</div>
|
||||
<div class="service-name">${service.name}</div>
|
||||
<div class="service-url">${service.url}</div>
|
||||
<div class="service-description">${service.description}</div>
|
||||
</a>
|
||||
`).join('');
|
||||
document.getElementById('stats').textContent = `共 ${services.length} 个服务`;
|
||||
}
|
||||
|
||||
function updateTime() {
|
||||
document.getElementById('updateTime').textContent = new Date().toLocaleString('zh-CN');
|
||||
}
|
||||
|
||||
renderServices();
|
||||
updateTime();
|
||||
setInterval(updateTime, 60000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: navigation
|
||||
namespace: navigation
|
||||
spec:
|
||||
# replicas 由 KEDA 管理,不设置固定值
|
||||
selector:
|
||||
matchLabels:
|
||||
app: navigation
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: navigation
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- containerPort: 80
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: 200m
|
||||
memory: 128Mi
|
||||
volumeMounts:
|
||||
- name: html
|
||||
mountPath: /usr/share/nginx/html
|
||||
volumes:
|
||||
- name: html
|
||||
configMap:
|
||||
name: navigation-html
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: navigation
|
||||
namespace: navigation
|
||||
spec:
|
||||
selector:
|
||||
app: navigation
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 80
|
||||
type: ClusterIP
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: navigation-ingress
|
||||
namespace: navigation
|
||||
annotations:
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: web
|
||||
spec:
|
||||
rules:
|
||||
- host: dh.u6.net3w.com
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: navigation
|
||||
port:
|
||||
number: 80
|
||||
Reference in New Issue
Block a user