Skip to content

arun9theja/kubernetes-yaml-templates

 
 

Repository files navigation

1 Kubernetes Yaml Templates

linkedin
github
slack


PRs Welcome

File me Issues or star this repo.

1.1 Pod

YamlSummary
pod/pod-dummy.yamlStart a dummy pod with a dead sleep loop
pod/pod-nginx.yamlStart a pod of sample app(nginx)
pod/pod-initcontainer-sysctl.yamlUse initContainer to run sysctl, when starting a Pod
pod/pod-healthcheck-nginx.yamlStart pod with tcp and http healthcheck
pod/pod-secrets.yamlPod use secrets as either volumes or environment variables
pod/pod-gitclone.yamlPod: use initContainer as sidecar to web host a git repo
pod/pod-hostaliases.yamlPod: add alias to /etc/hosts
pod/pod-serviceaccount.yamlStart pod with serviceaccount, instead of default serviceaccount
pod/pod-handlers.yamlPod’s events whenever it get started or stoppped
ReferenceLink: kubectl cheatsheet

1.2 Volume

YamlSummary
volume/volume-manual-pv.yamlCreate pv first, then pvc
volume/volume-mount-localpath.yamlMount a local folder to pods
volume/volume-emptydir.yamlCreate a empty folder, then mount to pods
volume/volume-ebs.yamlMount EBS volume to pod running in amazon instance with the same AZ
volume/volume-nfs.yamlCreate nfs pv
volume/volume-gcePersistentDisk.yamlMount GCE disk to pod running in amazon instance with the same AZ
volume/volume-digitalocean.yamlCreate DigitalOcean volume for your kubernetes cluster in DigitalOcean
ReferenceLink: kubectl cheatsheet, Link: volumes examples

1.3 Service

YamlSummary
service/service-loadbalancer.yamlService: loadbalancer
service/service-nodeport.yamlService: nodeport
service/service-ingress.yamlService: ingress
service/service-clusterip-nginx.yamlService: nginx with clusterip
service/service-cassandra.yamlService: cassandra
ReferenceLink: kubectl cheatsheet

1.4 Configmap/Envs

YamlSummary
config/pod-configmap.yamlCreate configmap from file, then use it as a pod volume
config/pod-environment-var.yamlStart a pod passing environment variables
config/pod-env-metada.yamlExpose metadata to pods
config/configmap-plaintext.yamlDefine configmap with plain text

1.5 Security - RBAC

YamlSummary
rbac/serviceaccount-default.yamlServiceaccount: basic usage
rbac/rbac-default.yamlServiceaccount: concret example
ReferenceLink: kubectl cheatsheet

1.6 Security - PodSecurityPolicy

YamlSummary
podsecurity/securitycontext-user.yamlConfigure userid, at both pod and container levels
podsecurity/podsecurity-privileged.yamlCreate pod security with privileged access
podsecurity/podsecurity-restricted.yamlCreate pod security with restricted access, then apply it later
podsecurity/podsecurity-enforce.yamlEnforce policy security by defining role and cluster role
podsecurity/podsecurity-advanced.yamlA more complicated definition of pod security policy
podsecurity/podsecurity-example.yamlA full example with everything included
LinksLink: kubectl cheatsheet

1.7 Security - NetworkPolicy

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

1.8 Quota & Limits

YamlSummary
quota/limitrange-pvc-size.yamlLimitRange: PVC size
quota/limitrange-pvc-cumulative-size.yamlResourceQuota: pvc count and storage size
quota/limitrange-mem-size.yamlLimitRange: Pod ram usage. Then apply it to namespace
ReferenceLink: kubectl cheatsheet

1.9 Deployment

YamlSummary
deployment/deployment-nginx.yamlDeploy nginx with 2 replicas
deployment/deployment-mysql.yamlDeploy mysql
ReferenceLink: kubectl cheatsheet

1.10 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
ReferenceLink: kubectl cheatsheet

1.11 Jobs & CronJob

YamlSummary
job/job-affinity.yamlDeploy a job with node affinity

1.12 HorizontalPodAutoscaler

YamlSummary
hpa/hpa-nginx.yamlDeploy a horizontal pod autoscaler for nginx deployment

1.13 Adhoc

YamlSummary
namespace/ns-dummy.yamlCreate a dummy namespace

1.14 Related Tools

NameSummary
GitHub: kubernetes-sigs/kustomizeCustomization of kubernetes YAML configurations

1.15 More Resources

License: Code is licensed under MIT License.

Releases

No releases published

Packages

No packages published