Skip to content

dennyzhang/kubernetes-yaml-templates

Repository files navigation

1 Kubernets Yaml Templates

linkedin
github
slack


PRs Welcome

File me Issues or star this repo.

See more CheatSheets from Denny: #denny-cheatsheets

Note: for each yaml in below, you can find a related URL at the top.

e.g, here is an example

1.1 Pod

YamlSummary
pod/pod-dummy.yamlStart a dummy pod with a dead sleep loop
pod/pod-environment-var.yamlStart a pod passing environment variables
pod/pod-secrets.yamlPod use secrets as either volumes or environment variables
pod/pod-nginx.yamlStart a pod of sample app(nginx)
pod/pod-healthcheck-nginx.yamlStart pod with tcp and http healthcheck
pod/pod-gitclone.yamlPod: sidecar with git clone
pod/pod-hostaliases.yamlPod: add alias to /etc/hosts
pod/pod-handlers.yamlPod’s events whenever it get started or stoppped
Linkslink: kubernetes cheatsheet

1.2 Volume

YamlSummary
volume/volume-manual-pv.yamlCreate pv first, then pvc
volume/volume-mount-localpath.yamlMount local folder to pods
volume/volume-emptydir.yamlCreate a empty folder, then mount to pods
statefulset/statefulset-replicated-cassandra.yamlUse minikube volume
Linkslink: kubernetes cheatsheet

1.3 Security

YamlSummary
security/serviceaccount-default.yamlServiceaccount: basic usage
security/podsecurity-no-priviledged.yamlPod security: prohibit pod with –privileged
security/podsecurity-advanced.yamlPod security: advanced usage
Linkslink: kubernetes cheatsheet

1.4 Security - NetworkPolicy

YamlSummary
security/networksecurity-denyall-ingress.yamlAllow all ingress
security/networksecurity-allowall-ingress.yamlDeny all ingress
security/networksecurity-denyall.yamlDeny all ingress and egress
security/networksecurity-pod.yamlWhitelist traffic control
security/networksecurity-complicated.yamlA comprehensive network policy example
security/networksecurity-port.yamlAllow TCP 443 from one namespace
security/networksecurity-deny-othernamespaces.yamlDeny all ingress traffic from other namespaces
security/networksecurity-denyegress-exceptdns.yamlDeny all egress traffic except DNS
Linkslink: kubernetes cheatsheet
LinksGitHub: kubernetes-network-policy-recipes

1.5 Quota & Limits

YamlSummary
quota/limitrange-pvc-size.yamlLimitRange: PVC size
quota/limitrange-pvc-cumulative-size.yamlResourceQuota: pvc count and storage size
Linkslink: kubernetes cheatsheet

1.6 Deployment

YamlSummary
deployment/deployment-nginx.yamlDeploy nginx with 2 replicas
deployment/deployment-mysql.yamlDeploy mysql
Linkslink: kubernetes cheatsheet

1.7 Statefulset

YamlSummary
statefulset/statefulset-nginx.yamlStatefulset: nginx
statefulset/statefulset-single-mysqlStatefulset: mysql
statefulset/statefulset-replicated-cassandra.yamlStatefulset: single cassandra
statefulset/statefulset-replicated-mysqlStatefulset: cassandra with replicas
Linkslink: kubernetes cheatsheet

1.8 Service

YamlSummary
service/service-clusterip-nginx.yamlService: nginx with clusterip
service/service-cassandra.yamlService: cassandra
Linkslink: kubernetes cheatsheet

1.9 More Resources

License: Code is licensed under MIT License.

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •