Add mycelium-website-hostnetwork.yaml deployment file
This commit is contained in:
193
examples/nginx-mycelium/mycelium-website-hostnetwork.yaml
Normal file
193
examples/nginx-mycelium/mycelium-website-hostnetwork.yaml
Normal file
@@ -0,0 +1,193 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mycelium-website
|
||||
labels:
|
||||
app: mycelium-website
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mycelium-website
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mycelium-website
|
||||
spec:
|
||||
hostNetwork: true
|
||||
dnsPolicy: ClusterFirst
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- containerPort: 80
|
||||
hostPort: 80
|
||||
volumeMounts:
|
||||
- name: html-content
|
||||
mountPath: /usr/share/nginx/html
|
||||
- name: nginx-config
|
||||
mountPath: /etc/nginx/conf.d
|
||||
volumes:
|
||||
- name: html-content
|
||||
configMap:
|
||||
name: mycelium-website-content
|
||||
- name: nginx-config
|
||||
configMap:
|
||||
name: mycelium-nginx-config
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: mycelium-website-content
|
||||
data:
|
||||
index.html: |
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Mycelium Cloud - Globally Accessible Website</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.container {
|
||||
text-align: center;
|
||||
max-width: 800px;
|
||||
padding: 2rem;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 20px;
|
||||
backdrop-filter: blur(10px);
|
||||
box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
|
||||
}
|
||||
h1 {
|
||||
font-size: 3rem;
|
||||
margin-bottom: 1rem;
|
||||
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
|
||||
}
|
||||
.subtitle {
|
||||
font-size: 1.2rem;
|
||||
margin-bottom: 2rem;
|
||||
opacity: 0.9;
|
||||
}
|
||||
.ipv6-info {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
padding: 1rem;
|
||||
border-radius: 10px;
|
||||
margin: 1rem 0;
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
.status {
|
||||
display: inline-block;
|
||||
padding: 0.5rem 1rem;
|
||||
background: #4CAF50;
|
||||
border-radius: 25px;
|
||||
font-weight: bold;
|
||||
margin: 0.5rem;
|
||||
}
|
||||
.timestamp {
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
.features {
|
||||
text-align: left;
|
||||
margin: 2rem 0;
|
||||
}
|
||||
.feature {
|
||||
margin: 0.5rem 0;
|
||||
padding: 0.5rem;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function updateTimestamp() {
|
||||
const now = new Date();
|
||||
document.getElementById('timestamp').textContent =
|
||||
'Last updated: ' + now.toLocaleString();
|
||||
}
|
||||
|
||||
function getIPv6Address() {
|
||||
// Extract IPv6 from the current connection
|
||||
const ipv6Pattern = /\[([0-9a-f:]+)\]/;
|
||||
const match = window.location.href.match(ipv6Pattern);
|
||||
if (match) {
|
||||
document.getElementById('current-ipv6').textContent = match[1];
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
updateTimestamp();
|
||||
getIPv6Address();
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>🌐 Mycelium Cloud</h1>
|
||||
<div class="subtitle">
|
||||
Your website is now globally accessible via IPv6!
|
||||
</div>
|
||||
|
||||
<div class="status">
|
||||
✅ GLOBAL ACCESSIBLE
|
||||
</div>
|
||||
|
||||
<div class="ipv6-info">
|
||||
<strong>Connected via IPv6:</strong><br>
|
||||
<span id="current-ipv6">Loading...</span>
|
||||
</div>
|
||||
|
||||
<div class="features">
|
||||
<h3>🚀 Key Features:</h3>
|
||||
<div class="feature">🌍 Peer-to-peer global access without traditional hosting</div>
|
||||
<div class="feature">🔒 Secure IPv6-only communications</div>
|
||||
<div class="feature">⚡ Direct node-to-node connectivity</div>
|
||||
<div class="feature">🖥️ 3-Master, 3-Worker Kubernetes cluster</div>
|
||||
<div class="feature">🔄 Dynamic IPv6 discovery and routing</div>
|
||||
</div>
|
||||
|
||||
<div class="timestamp" id="timestamp">
|
||||
Loading timestamp...
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 2rem; font-size: 0.8rem;">
|
||||
Mycelium Cloud Website Demo<br>
|
||||
Proof of Concept: IPv6 Website Hosting
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: mycelium-nginx-config
|
||||
data:
|
||||
default.conf: |
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
location /health {
|
||||
access_log off;
|
||||
return 200 "healthy\n";
|
||||
add_header Content-Type text/plain;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user