给出完整的busybox例子
时间: 2023-08-11 11:57:19 浏览: 43
以下是一个完整的BusyBox StatefulSet示例,使用Cilium插件创建具有固定IP的Pod:
```yaml
apiVersion: v1
kind: Service
metadata:
name: busybox-service
spec:
selector:
app: busybox
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: busybox-statefulset
spec:
selector:
matchLabels:
app: busybox
serviceName: busybox-service
replicas: 3
template:
metadata:
labels:
app: busybox
spec:
terminationGracePeriodSeconds: 10
containers:
- name: busybox
image: busybox
command:
- sleep
- "3600"
ports:
- containerPort: 8080
```
你可以将上述示例保存为`busybox-statefulset.yaml`文件,并使用以下命令在Kubernetes集群中创建BusyBox StatefulSet:
```shell
kubectl apply -f busybox-statefulset.yaml
```
这将创建一个包含3个BusyBox Pod的StatefulSet,在每个Pod中都分配了固定的IP地址,并且通过Service进行访问。