Browsing this Thread:   1 Anonymous Users






kubernetes k8s halo blog
#1
Just can't stay away
Just can't stay away


See User information
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

Posted on: 2022/10/13 14:37

Edited by eyex on 2022/10/24 16:40:19
Top


Re: kubernetes k8s halo blog
#2
Just can't stay away
Just can't stay away


See User information
mysql/mysql-pv.yaml

apiVersion: v1
kind
: PersistentVolume
metadata
:
  
name: mysql-pv-volume
  labels
:
    
type: local
spec
:
  
storageClassName: manual
  capacity
:
    
storage: 20Gi
  accessModes
:
    - 
ReadWriteOnce
  hostPath
:
    
path: "/mnt/data"
---
apiVersion: v1
kind
: PersistentVolumeClaim
metadata
:
  
name: mysql-pv-claim
spec
:
  
storageClassName: manual
  accessModes
:
    - 
ReadWriteOnce
  resources
:
    
requests:
      
storage: 20Gi



mysql/mysql-deployment.yaml


apiVersion: v1
kind
: Service
metadata
:
  
name: mysql
spec
:
  
ports:
  - 
port: 3306
  selector
:
    
app: mysql
  clusterIP
: None
---
apiVersion: apps/v1
kind
: Deployment
metadata
:
  
name: mysql
spec
:
  
selector:
    
matchLabels:
      
app: mysql
  strategy
:
    
type: Recreate
  template
:
    
metadata:
      
labels:
        
app: mysql
    spec
:
      
containers:
      - 
image: mysql:8.2
        name
: mysql
        env
:
          
# Use secret in real usage
        
- name: MYSQL_ROOT_PASSWORD
          value
: password
        ports
:
        - 
containerPort: 3306
          name
: mysql
        volumeMounts
:
        - 
name: mysql-persistent-storage
          mountPath
: /var/lib/mysql
      volumes
:
      - 
name: mysql-persistent-storage
        persistentVolumeClaim
:
          
claimName: mysql-pv-claim

Posted on: 2023/11/24 23:21
Top


Re: kubernetes k8s halo blog
#3
Just can't stay away
Just can't stay away


See User information
application.yaml

server:
  
port: 8090
  
# Response data gzip.
  
compression:
    
enabled: false
spring
:
  
datasource:
   
# MySQL database configuration.
    
driver-class-name: com.mysql.cj.jdbc.Driver
    url
: jdbc:mysql://mysql:3306/halo_test_db?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
    
username: halo_test_user
    password
: 123456

##  redis:
##    # Redis cache configuration.
##    port: 6379
##    database: 9
##    host: 10.1.133.64
##    password: 123456
##

halo:

  
# Your admin client path is https://your-domain/{admin-path}
  
admin-path: admin

  
# memory or level
  
cache: memory

Posted on: 2023/11/24 23:23
Top








Themes

(2 themes)
Login
Username:

Password:


Lost Password?
Register now!
Categories
Xoops (11)
--Modules (2)
--Themes (0)
Article (8)