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

apiVersionapps/v1 # for versions before 1.9.0 use apps/v1beta2
kindDeployment
metadata
:
  
namehalo-blog
spec
:
  
selector:
    
matchLabels:
      
apphalo-blog
  replicas
# tells deployment to run 2 pods matching the template
  
template:
    
metadata:
      
labels:
        
apphalo-blog
    spec
:
      
containers:
      - 
namehalo-blog
        image
halohub/halo:1.6.0
        volumeMounts
:
        - 
namehalo-storage
          mountPath
: /root/.halo
      volumes
:
      - 
namehalo-storage
        hostPath
:
          
path: ~/k8s.storage/halo
          type
DirectoryOrCreate



halo.svc.yaml

apiVersionv1
kind
Service
metadata
:
  
namehalo-blog
  labels
:
    
apphalo-blog
spec
:
  
typeNodePort
  ports
:
    - 
port8090 # 集群内部通信的端口
      
targetPort8090 # 指向pods端口
      
nodePort30089 # 对外暴露的工作节点端口
  
selector:
    
apphalo-blog


halo.ingress.yaml

apiVersionnetworking.k8s.io/v1
kind
Ingress
metadata
:
  
namehalo-ingress
spec
:
  
rules:
  - 
hosthalo.16.9.8.16.nip.io
    http
:
      
paths:
      - 
path: /
        
pathTypePrefix
        backend
:
          
service:
            
namehalo-blog
            port
:
              
number8090

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

apiVersionv1
kind
PersistentVolume
metadata
:
  
namemysql-pv-volume
  labels
:
    
typelocal
spec
:
  
storageClassNamemanual
  capacity
:
    
storage20Gi
  accessModes
:
    - 
ReadWriteOnce
  hostPath
:
    
path"/mnt/data"
---
apiVersionv1
kind
PersistentVolumeClaim
metadata
:
  
namemysql-pv-claim
spec
:
  
storageClassNamemanual
  accessModes
:
    - 
ReadWriteOnce
  resources
:
    
requests:
      
storage20Gi



mysql/mysql-deployment.yaml


apiVersionv1
kind
Service
metadata
:
  
namemysql
spec
:
  
ports:
  - 
port3306
  selector
:
    
appmysql
  clusterIP
None
---
apiVersionapps/v1
kind
Deployment
metadata
:
  
namemysql
spec
:
  
selector:
    
matchLabels:
      
appmysql
  strategy
:
    
typeRecreate
  template
:
    
metadata:
      
labels:
        
appmysql
    spec
:
      
containers:
      - 
imagemysql:8.2
        name
mysql
        env
:
          
# Use secret in real usage
        
nameMYSQL_ROOT_PASSWORD
          value
password
        ports
:
        - 
containerPort3306
          name
mysql
        volumeMounts
:
        - 
namemysql-persistent-storage
          mountPath
: /var/lib/mysql
      volumes
:
      - 
namemysql-persistent-storage
        persistentVolumeClaim
:
          
claimNamemysql-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:
  
port8090
  
# Response data gzip.
  
compression:
    
enabledfalse
spring
:
  
datasource:
   
# MySQL database configuration.
    
driver-class-namecom.mysql.cj.jdbc.Driver
    url
jdbc:mysql://mysql:3306/halo_test_db?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
    
usernamehalo_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-pathadmin

  
# memory or level
  
cachememory

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








friend links
Themes

(2 themes)
Login
Username:

Password:


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