树莓派集群安装rpi-busybox-httpd测试服务
2021-03-03 本文已影响0人
forrestsun
一 配置安装
apiVersion: v1
kind: Namespace
metadata:
name: k3s-demo #自定义的命名空间
---
apiVersion: v1
kind: Service
metadata:
name: httpdemo
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
nodePort: 31000
protocol: TCP
name: port
type: NodePort
selector:
app: httpdemo
---
apiVersion: v1
kind: ReplicationController
metadata:
name: httpdemo
spec:
replicas: 3
template:
metadata:
labels:
app: httpdemo
spec:
containers:
- name: server
image: hypriot/rpi-busybox-httpd
ports:
- containerPort: 80
运行命令: kubectl create -f httpd

集群内任意IP地址均可访问测试网站

二 遗留问题
Error from server (Invalid): error when creating "httpd/httpd.yaml": Service "httpdemo" is invalid: spec.ports[0].nodePort: Invalid value: 8000: provided port is not in the valid range. The range of valid ports is 30000-32767