kubernetes halo blog demo
halo.dep.yaml
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: halo-blog
spec:
selector:
matchLabels:
app: halo-blog
replicas: 1 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: halo-blog
spec:
containers:
- name: halo-blog
image: halohub/halo:1.6.0
volumeMounts:
- name: halo-storage
mountPath: /root/.halo
volumes:
- name: halo-storage
hostPath:
path: ~/k8s.storage/halo
type: DirectoryOrCreate
halo.svc.yaml
apiVersion: v1
kind: Service
metadata:
name: halo-blog
labels:
app: halo-blog
spec:
type: NodePort
ports:
- port: 8090 # 集群内部通信的端口
targetPort: 8090 # 指向pods端口
nodePort: 30089 # 对外暴露的工作节点端口
selector:
app: halo-blog
halo.ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: halo-ingress
spec:
rules:
- host: halo.16.9.8.16.nip.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: halo-blog
port:
number: 8090