试运行:
kubectl create deployment nginx —image=nginx —dry-run -o yaml >deployment.yaml
kubectl expose deployment nginx —port=80 —target-port=80 —type=NodePort —dry-run -o yaml >service.yaml
kubectl run busybox —image=busybox:1.34 —command — sleep 3600
kubectl run a —image alpine —command — /bin/sleep 1d
kubectl run a —image yauritux/busybox-curl —command — /bin/sleep 1d
docker run -itd —name test docker.io/nginx:latest
docker run -itd —privileged=true —name test —hostname test —restart unless-stopped —net=host —cpus=1 -m 512M -v /tmp:/tmp -w /opt -p 80:80 -e MYSQL_IP=192.168.1.1 —device=/dev/uhid docker.io/nginx:latest
apiVersion: v1
kind: Pod
metadata:
name: busybox-test
namespace: ocp-test
spec:
nodeName: node6.dmz.ht.paas.cmic.cn
containers:
- image: busybox-curl:paping
command: [“/bin/sh”]
args: [“-c”, “sleep 3600”]
imagePullPolicy: IfNotPresent
name: busybox
resources:
limits:
cpu: “2”
memory: 500Mi
requests:
cpu: 500m
memory: 200Mi
restartPolicy: Always
apiVersion: v1
kind: Pod
metadata:
name: busybox-tset
namespace: ocp-test
spec:
containers:
- image: registry.dev.ht.paas.cmic.cn:5000/busybox
command:
- sleep
- “3600”
imagePullPolicy: IfNotPresent
name: busybox
restartPolicy: Always
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: ocp-test
spec:
# nodeName: node6.dmz.ht.paas.cmic.cn
containers:
- image: harbor.ht.paas.ht.cmic.cn/ceshi/busybox:latest
command: [“/bin/sh”]
#args: [“while true; do echo ‘Hello World’; sleep 10; done”]
args: [“-c”, “sleep 3600”]
imagePullPolicy: IfNotPresent
name: busybox
# volumeMounts:
# - mountPath: /mnt
# name: peoplecloud-nfs-pvc-test
# hostNetwork: true
resources:
limits:
cpu: “2”
memory: 500Mi
requests:
cpu: 500m
memory: 200Mi
restartPolicy: Always
# volumes:
# - name: peoplecloud-nfs-pvc-test
# persistentVolumeClaim:
# claimName: peoplecloud-nfs-pvc
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
labels:
k8s-app: centos-test
name: centos-test
namespace: ocp-test
spec:
selector:
matchLabels:
k8s-app: centos-test
template:
metadata:
labels:
k8s-app: centos-test
spec:
containers:
- args:
- /bin/bash
- -c
- sleep 600
image: harbor.ht.paas.ht.cmic.cn/system_containers/centos:v1
imagePullPolicy: IfNotPresent
name: centos-test
resources:
limits:
cpu: “10m”
memory: 10Mi
requests:
cpu: 10m
memory: 10Mi
貌似只有这个版本 busybox:1.28.3 nslookup 好用一些
apiVersion: apps/v1
kind: Deployment
metadata:
name: busybox-deployment-v1
spec:
replicas: 3
selector:
matchLabels:
app: busybox-v1
template:
metadata:
labels:
app: busybox-v1
spec:
containers:
- name: busybox-host
image: busybox:1.28.3
command: [“sleep”]
args: [“1000”]
#nodeName: 10.71.8.33
#dnsPolicy: Default
#dnsPolicy: ClusterFirstWithHostNet
含curl的 busybox
apiVersion: v1
kind: Pod
metadata:
name: busybox
namespace: default
spec:
containers:
- image: yauritux/busybox-curl
command:
- sleep
- “3600”
imagePullPolicy: IfNotPresent
name: busybox
restartPolicy: Always
