diff --git a/k8s-manifest-templates/clusterrolebindings-template.yaml b/k8s-manifest-templates/clusterrolebindings-template.yaml new file mode 100644 index 0000000..f13472e --- /dev/null +++ b/k8s-manifest-templates/clusterrolebindings-template.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: crb-example +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: xyz +subjects: + - kind: ServiceAccount + name: xyz + namespace: xyz diff --git a/k8s-manifest-templates/clusterroles-template.yaml b/k8s-manifest-templates/clusterroles-template.yaml new file mode 100644 index 0000000..c3d22fa --- /dev/null +++ b/k8s-manifest-templates/clusterroles-template.yaml @@ -0,0 +1,35 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: cr-example +rules: + - apiGroups: + - "" + resources: + - events + verbs: + - list + - create + - apiGroups: + - "" + resources: + - pods + - pods/log + verbs: + - get + - apiGroups: + - argoproj.io + resources: + - applications + - applicationsets + verbs: + - get + - list + - update + - watch + - apiGroups: + - batch + resources: + - jobs + verbs: + - create diff --git a/k8s-manifest-templates/configmap-template.yaml b/k8s-manifest-templates/configmap-template.yaml new file mode 100644 index 0000000..b5f54ff --- /dev/null +++ b/k8s-manifest-templates/configmap-template.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +data: + key1: value1 + key2: value2 +kind: ConfigMap +metadata: + creationTimestamp: null + name: configmap-example + namespace: xyz diff --git a/k8s-manifest-templates/cronjob-template.yaml b/k8s-manifest-templates/cronjob-template.yaml new file mode 100644 index 0000000..e671125 --- /dev/null +++ b/k8s-manifest-templates/cronjob-template.yaml @@ -0,0 +1,19 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: cronjob-example +spec: + schedule: "* * * * *" + jobTemplate: + spec: + template: + spec: + containers: + - name: cronjob-example + image: busybox:1.28 + imagePullPolicy: IfNotPresent + command: + - /bin/sh + - -c + - date; echo Hello from the Kubernetes cluster + restartPolicy: OnFailure diff --git a/k8s-manifest-templates/daemonset-template.yaml b/k8s-manifest-templates/daemonset-template.yaml new file mode 100644 index 0000000..73e5772 --- /dev/null +++ b/k8s-manifest-templates/daemonset-template.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: daemonset-example + namespace: kube-system + labels: + k8s-app: daemonset-example +spec: + selector: + matchLabels: + name: daemonset-example + template: + metadata: + labels: + name: daemonset-example + spec: + tolerations: + # these tolerations are to have the daemonset runnable on control plane nodes + # remove them if your control plane nodes should not run pods + - key: node-role.kubernetes.io/control-plane + operator: Exists + effect: NoSchedule + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule + containers: + - name: daemonset-example + image: quay.io/fluentd_elasticsearch/fluentd:v2.5.2 + resources: + limits: + memory: 200Mi + requests: + cpu: 100m + memory: 200Mi + volumeMounts: + - name: varlog + mountPath: /var/log + # it may be desirable to set a high priority class to ensure that a DaemonSet Pod + # preempts running Pods + # priorityClassName: important + terminationGracePeriodSeconds: 30 + volumes: + - name: varlog + hostPath: + path: /var/log + diff --git a/k8s-manifest-templates/deploy-template.yaml b/k8s-manifest-templates/deploy-template.yaml new file mode 100644 index 0000000..c23dcbb --- /dev/null +++ b/k8s-manifest-templates/deploy-template.yaml @@ -0,0 +1,25 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + creationTimestamp: null + labels: + app: deploy-example + name: deploy-example + namespace: xyz +spec: + replicas: 2 + selector: + matchLabels: + app: deploy-example + strategy: {} + template: + metadata: + creationTimestamp: null + labels: + app: deploy-example + spec: + containers: + - image: nginx + name: nginx + resources: {} +status: {} diff --git a/k8s-manifest-templates/hpa-template.yaml b/k8s-manifest-templates/hpa-template.yaml new file mode 100644 index 0000000..cf61c88 --- /dev/null +++ b/k8s-manifest-templates/hpa-template.yaml @@ -0,0 +1,25 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: hpa-example + namespace: xyz +spec: + maxReplicas: 6 + metrics: + - resource: + name: memory + target: + averageUtilization: 70 + type: Utilization + type: Resource + - resource: + name: cpu + target: + averageUtilization: 70 + type: Utilization + type: Resource + minReplicas: 1 + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: deploy-example diff --git a/k8s-manifest-templates/ingress-template.yaml b/k8s-manifest-templates/ingress-template.yaml new file mode 100644 index 0000000..a99c543 --- /dev/null +++ b/k8s-manifest-templates/ingress-template.yaml @@ -0,0 +1,18 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: ingress-example + annotations: + nginx.ingress.kubernetes.io/rewrite-target: / +spec: + ingressClassName: nginx + rules: + - http: + paths: + - path: /testpath + pathType: Prefix + backend: + service: + name: svc-example + port: + number: 80 diff --git a/k8s-manifest-templates/job-template.yaml b/k8s-manifest-templates/job-template.yaml new file mode 100644 index 0000000..c247411 --- /dev/null +++ b/k8s-manifest-templates/job-template.yaml @@ -0,0 +1,13 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: job-example +spec: + template: + spec: + containers: + - name: job-example + image: perl:5.34.0 + command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"] + restartPolicy: Never + backoffLimit: 4 diff --git a/k8s-manifest-templates/namespace-template.yaml b/k8s-manifest-templates/namespace-template.yaml new file mode 100644 index 0000000..965bde4 --- /dev/null +++ b/k8s-manifest-templates/namespace-template.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Namespace +metadata: + creationTimestamp: null + name: example-ns +spec: {} +status: {} diff --git a/k8s-manifest-templates/pdb-template.yaml b/k8s-manifest-templates/pdb-template.yaml new file mode 100644 index 0000000..60f9942 --- /dev/null +++ b/k8s-manifest-templates/pdb-template.yaml @@ -0,0 +1,9 @@ +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: pdb-example +spec: + minAvailable: 50% + selector: + matchLabels: + app: nginx diff --git a/k8s-manifest-templates/pod-template.yaml b/k8s-manifest-templates/pod-template.yaml new file mode 100644 index 0000000..0cf3d46 --- /dev/null +++ b/k8s-manifest-templates/pod-template.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Pod +metadata: + name: pod-example + labels: + purpose: pod-example +spec: + containers: + - name: pod-example + image: debian + command: ["printenv"] + args: ["HOSTNAME", "KUBERNETES_PORT"] + restartPolicy: OnFailure + diff --git a/k8s-manifest-templates/pvc-template.yaml b/k8s-manifest-templates/pvc-template.yaml new file mode 100644 index 0000000..b500525 --- /dev/null +++ b/k8s-manifest-templates/pvc-template.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: pvc-example +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 3Gi + diff --git a/k8s-manifest-templates/role-template.yaml b/k8s-manifest-templates/role-template.yaml new file mode 100644 index 0000000..9a6aa10 --- /dev/null +++ b/k8s-manifest-templates/role-template.yaml @@ -0,0 +1,20 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: role-example + namespace: xyz +rules: + - apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - create + - get + - update + - apiGroups: + - "" + resources: + - secrets + verbs: + - get diff --git a/k8s-manifest-templates/rolebindings-template.yaml b/k8s-manifest-templates/rolebindings-template.yaml new file mode 100644 index 0000000..f06ace1 --- /dev/null +++ b/k8s-manifest-templates/rolebindings-template.yaml @@ -0,0 +1,14 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: rolebinding-example + namespace: xyz +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: xyz +subjects: + - kind: ServiceAccount + name: xyz + namespace: xyz + diff --git a/k8s-manifest-templates/secret-template.yaml b/k8s-manifest-templates/secret-template.yaml new file mode 100644 index 0000000..54b5088 --- /dev/null +++ b/k8s-manifest-templates/secret-template.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +data: + key1: dmFsdWUx + key2: dmFsdWUy +kind: Secret +metadata: + creationTimestamp: null + name: secret-example + namespace: xyz diff --git a/k8s-manifest-templates/statefulsets-template.yaml b/k8s-manifest-templates/statefulsets-template.yaml new file mode 100644 index 0000000..df0dc68 --- /dev/null +++ b/k8s-manifest-templates/statefulsets-template.yaml @@ -0,0 +1,35 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: nginx +spec: + selector: + matchLabels: + app: nginx # has to match .spec.template.metadata.labels + serviceName: "nginx" + replicas: 1 # by default is 1 + minReadySeconds: 10 # by default is 0 + template: + metadata: + labels: + app: nginx # has to match .spec.selector.matchLabels + spec: + terminationGracePeriodSeconds: 10 + containers: + - name: nginx + image: registry.k8s.io/nginx-slim:0.24 + ports: + - containerPort: 80 + name: web + volumeMounts: + - name: www + mountPath: /usr/share/nginx/html + volumeClaimTemplates: + - metadata: + name: www + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: "" + resources: + requests: + storage: 1Gi diff --git a/k8s-manifest-templates/svc-template.yaml b/k8s-manifest-templates/svc-template.yaml new file mode 100644 index 0000000..ea32c3e --- /dev/null +++ b/k8s-manifest-templates/svc-template.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + creationTimestamp: null + labels: + app: svc-example + name: svc-example + namespace: xyz +spec: + ports: + - name: 80-8080 + port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: svc-example + type: ClusterIP +status: + loadBalancer: {}