diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..120e031 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,84 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. + +> [!NOTE] +> +> ## Our Standards +> +> Examples of behavior that contributes to a positive environment for our community include: +> +> * Demonstrating empathy and kindness toward other people +> * Being respectful of differing opinions, viewpoints, and experiences +> * Giving and gracefully accepting constructive feedback +> * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience +> * Focusing on what is best not just for us as individuals, but for the overall community +> +> Examples of unacceptable behavior include: +> +> * The use of sexualized language or imagery, and sexual attention or advances of any kind +> * Trolling, insulting or derogatory comments, and personal or political attacks +> * Public or private harassment +> * Publishing others’ private information, such as a physical or email address, without their explicit permission +> * Other conduct which could reasonably be considered inappropriate in a professional setting + +> [!IMPORTANT] +> +> ## Enforcement Responsibilities +> +> Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. +> +> Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [prodevopsguytech@gmail.com]. All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the reporter of any incident. + +## Enforcement Guidelines + +> [!CAUTION] +Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: +> +> ### 1. Correction +> +>**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. +> +>**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. +> +> ### 2. Warning +> +> **Community Impact**: A violation through a single incident or series of actions. +> +> **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. + +> [!WARNING] +> +> ### 3. Temporary Ban +> +>**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. +> +> **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. +> +> ### 4. Permanent Ban +> +> **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. +> +> **Consequence**: A permanent ban from any sort of public interaction within the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at . + +Community Impact Guidelines were inspired by [Mozilla’s code of conduct enforcement ladder](https://github.com/mozilla/diversity). + +For answers to common questions about this code of conduct, see the FAQ at . Translations are available at . diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8031e08 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,16 @@ +# Contributing to π˜Όπ™‘π™‘ π™žπ™£ π™Šπ™£π™š 𝙗π™ͺπ™™π™™π™‘π™š 𝙀𝙛 𝙆π™ͺπ™—π™šπ™§π™£π™šπ™©π™šπ™¨ + +> [!IMPORTANT] +> +> We welcome contributions! Here's how you can help: +> +> 1. **Fork the Repository**: Create your own copy of the repository by forking it. +> 2. **Create a Branch**: Make a new branch for your work. +> 3. **Make Changes**: Implement your changes or new features. +> 4. **Submit a Pull Request**: Submit your changes for review. + +--- + +> [!NOTE] +> +> Please follow our [Code of Conduct](CODE_OF_CONDUCT.md) and make sure your code adheres to our guidelines. diff --git a/README.md b/README.md index a7dae5d..02131cc 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,176 @@ -# π˜Όπ™‘π™‘ π™žπ™£ π™Šπ™£π™š 𝙗π™ͺπ™™π™™π™‘π™š 𝙀𝙛 𝙆π™ͺπ™—π™šπ™§π™£π™šπ™©π™šπ™¨ +# πŸš€ **The Ultimate Kubernetes All-in-One Bundle** -![Kubernetes](https://imgur.com/sKgcng3.png) +![Kubernetes](https://imgur.com/OMxHx1Z.png) -## This Repository includes:- +## πŸ“Œ **Purpose of the Repository** -1. **Deployment manifest files**: These files outline the specifications for deploying applications or services onto a platform, defining aspects like containers, volumes, and configurations. +> [!IMPORTANT] +> +> This repository is a comprehensive resource designed to help users **master Kubernetes from the ground up**. Whether you're a beginner exploring basic deployments or a professional working on **real-time, production-grade Kubernetes applications**, this repo has you covered. +> +> Key highlights include: +> +> - Pre-configured **YAML manifests** for common workloads +> - **CI/CD pipelines** with Jenkins and GitHub Actions +> - **Ingress configurations** for traffic management +> - Reusable **Helm charts** +> - Real-world application manifests and scenarios +> +> The content is tailored to support deployment, scaling, and management of Kubernetes clusters across environments like **AWS**, **Azure**, **GCP**, and **on-premise** setups. You’ll also find dedicated resources on: +> +> - Kubernetes **security best practices** +> - **Performance tuning** +> - **DevOps automation** strategies for modern cloud-native apps -2. **Jenkins deployments & configurations**: Jenkins is an automation server used for continuous integration and deployment. This includes scripts and configurations for deploying applications using Jenkins. +--- -3. **Kubernetes Ingress files**: Ingress defines rules for routing external HTTP(S) traffic to services within a Kubernetes cluster. These files specify how incoming requests should be forwarded to the appropriate services. +## πŸ“‚ **Analysis of Repository Contents** -4. **Realtime projects manifest files**: Manifest files for real-time projects contain configurations and specifications necessary for deploying and running real-time applications or services. +> [!NOTE] +> +> This repository takes a **practical, hands-on approach** to Kubernetes by offering: +> +> - βœ… Ready-to-deploy **Helm charts** +> - βœ… Pre-built **Jenkins CI/CD pipelines** +> - βœ… Configurable **Kubernetes ingress controllers** +> - βœ… Integrated **Prometheus + Grafana** monitoring stacks +> - βœ… Manifests for **scalable, production-ready applications** +> - βœ… Centralized logging with the **ELK Stack** +> - βœ… Advanced **Kubernetes networking** and policy configs +> +> Each section is crafted to reflect **industry-grade practices**, ensuring you're equipped to build, secure, and maintain robust Kubernetes infrastructures. This repo is perfect for developers, SREs, and DevOps engineers looking to deploy **enterprise-ready** apps with confidence. -5. **Helm charts for any application**: Helm is a package manager for Kubernetes, facilitating the deployment and management of applications. These charts provide pre-configured templates for deploying various applications on Kubernetes. +--- -6. **End to End Manifest files for any applications**: These files provide comprehensive configurations covering all aspects of deploying and running applications, ensuring a complete end-to-end setup. +## πŸ”₯ **What's Inside?** -7. **Includes AWS ELK Stack (Elasticsearch, Logstash, Kibana)**: This includes configurations and setup for deploying the ELK Stack (Elasticsearch, Logstash, Kibana) on AWS for log management and analytics. +![Kubernetes](https://imgur.com/60qWgLs.png) -8. **Network service configurations templates**: Templates for configuring network services, specifying rules and settings for networking components such as load balancers, firewalls, and DNS. +### ⚑ **1️⃣ Kubernetes Deployment Manifests** -9. **Application monitoring templates for any applications**: Templates for setting up monitoring solutions to track the performance and health of applications, typically using tools like Prometheus, Grafana, or AWS CloudWatch. +- Pre-configured **YAML files** for hassle-free deployments πŸš€ +- Includes **Pods, ReplicaSets, Deployments, Services, StatefulSets & more!** -10. **Complete application launch manifest files for real-time projects**: Comprehensive manifest files for launching real-time projects, covering all necessary configurations and dependencies for successful deployment. +### βš™οΈ **2️⃣ Jenkins Deployments & CI/CD Configurations** -## Hit the Star! ⭐ -***If you are planning to use this repo for learning, please hit the star. Thanks!*** +- **Automate Kubernetes deployments** with Jenkins Pipelines +- Ready-to-use **Jenkins Helm Charts** for streamlined CI/CD -### Author by: +### 🌐 **3️⃣ Kubernetes Ingress Configurations** -![](https://imgur.com/2j6Aoyl.png) +- Secure & optimize app traffic using **Ingress controllers** +- Configurations for **Nginx, Traefik, and AWS ALB Ingress** -> [!Note] -> Join Our [Telegram Community](https:t.me/prodevopsguy) || [Follow me](https://github.com/NotHarshhaa) for more DevOps Content +### πŸ“‘ **4️⃣ Real-Time Project Manifest Files** + +- Hands-on Kubernetes projects covering **real-world DevOps use cases** +- Production-ready configurations for **scalable, fault-tolerant applications** + +### 🎩 **5️⃣ Helm Charts for Any Application** + +- **Pre-built Helm charts** to speed up deployments πŸš€ +- Follows **best practices for Helm package management** + +### πŸš€ **6️⃣ End-to-End Deployment Manifests** + +- Complete application launch templates for **enterprise-grade projects** +- Works across **AWS, Azure, GCP, and on-prem Kubernetes clusters** + +### πŸ”Ž **7️⃣ AWS ELK Stack (Elasticsearch, Logstash, Kibana)** + +- **Centralized log management** using ELK Stack on AWS +- **Highly available ELK on Kubernetes** configurations + +### πŸ”§ **8️⃣ Kubernetes Networking & Service Configurations** + +- **Service discovery, load balancing & DNS configurations** +- Includes **ClusterIP, NodePort, LoadBalancer & Network Policies** + +### πŸ“ˆ **9️⃣ Application Monitoring & Observability** + +- Built-in monitoring solutions using **Prometheus & Grafana** +- Pre-configured **dashboards for real-time observability** + +### πŸ† **πŸ”Ÿ Complete Application Launch Manifests for Real-Time Projects** + +- **Battle-tested Kubernetes configurations** for production-ready apps +- **End-to-end deployment strategies** used by DevOps professionals + +--- + +## πŸ› οΈ **Additional Resources & Best Practices** + +### πŸ“Œ **βœ… Kubernetes Security Best Practices** + +- Secure **container images** & Kubernetes secrets πŸ” +- Implement **RBAC, Pod Security Policies, and Network Policies** + +### πŸ“Œ **πŸš€ Kubernetes Performance Tuning** + +- Optimize **Kubernetes clusters** for high performance +- **Resource limits, Horizontal Pod Autoscaling, and Taints & Tolerations** + +### πŸ“Œ **☁️ Cloud-Native & Hybrid Deployments** + +- How to deploy Kubernetes on **AWS EKS, Azure AKS & GCP GKE** +- Guide to **on-prem vs. cloud Kubernetes deployments** + +### πŸ“Œ **πŸ”₯ DevOps Automation with Kubernetes** + +- Automate **application scaling, rolling updates & blue-green deployments** +- **GitOps with ArgoCD & Flux for declarative Kubernetes management** + +--- + +## **Code of Conduct** + +> [!CAUTION] +> +> We are committed to fostering a welcoming and respectful environment for all contributors. Please take a moment to review our [Code of Conduct](./CODE_OF_CONDUCT.md) before participating in this community. + +--- + +## **Contribute and Collaborate** + +> [!TIP] +> This repository thrives on community contributions and collaboration. Here’s how you can get involved: +> +> - **Fork the Repository:** Create your own copy of the repository to work on. +> - **Submit Pull Requests:** Contribute your projects or improvements to existing projects by submitting pull requests. +> - **Engage with Others:** Participate in discussions, provide feedback on others’ projects, and collaborate to create better solutions. +> - **Share Your Knowledge:** If you’ve developed a new project or learned something valuable, share it with the community. Your contributions can help others in their learning journey. + +--- + +## **Join the Community** + +> [!IMPORTANT] +> We encourage you to be an active part of our community: +> +> - **Join Our Telegram Community:** Connect with fellow DevOps enthusiasts, ask questions, and share your progress in our [Telegram group](https://t.me/prodevopsguy). +> - **Follow Me on GitHub:** Stay updated with new projects and content by [following me on GitHub](https://github.com/NotHarshhaa). + +--- + +## **Hit the Star!** ⭐ + +**If you find this repository helpful and plan to use it for learning, please give it a star. Your support is appreciated!** + +--- + +## πŸ› οΈ **Author & Community** + +This project is crafted by **[Harshhaa](https://github.com/NotHarshhaa)** πŸ’‘. +I’d love to hear your feedback! Feel free to share your thoughts. + +--- + +### πŸ“§ **Connect with me:** + +[![LinkedIn](https://img.shields.io/badge/LinkedIn-%230077B5.svg?style=for-the-badge&logo=linkedin&logoColor=white)](https://linkedin.com/in/harshhaa-vardhan-reddy) [![GitHub](https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/NotHarshhaa) [![Telegram](https://img.shields.io/badge/Telegram-26A5E4?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/prodevopsguy) [![Dev.to](https://img.shields.io/badge/Dev.to-0A0A0A?style=for-the-badge&logo=dev.to&logoColor=white)](https://dev.to/notharshhaa) [![Hashnode](https://img.shields.io/badge/Hashnode-2962FF?style=for-the-badge&logo=hashnode&logoColor=white)](https://hashnode.com/@prodevopsguy) + +--- + +### πŸ“’ **Stay Connected** + +![Follow Me](https://imgur.com/2j7GSPs.png) diff --git a/alpine/alpine-pod-2-containers.yaml b/alpine/alpine-pod-2-containers.yaml index 4cbfd15..bec829f 100644 --- a/alpine/alpine-pod-2-containers.yaml +++ b/alpine/alpine-pod-2-containers.yaml @@ -1,26 +1,46 @@ apiVersion: v1 kind: Pod metadata: - #creationTimestamp: null - labels: - run: alpine-2-containers name: alpine-2-containers + labels: + app: alpine-2-containers spec: containers: - - args: - - /bin/sh - - -c - - echo hello;sleep 10000 - image: alpine - name: alpine1 - #resources: {} - - args: - - /bin/sh - - -c - - echo hello;sleep 10000 - image: alpine - name: alpine2 - #resources: {} + - name: alpine1 + image: alpine:latest + command: ["/bin/sh", "-c"] + args: + - | + echo "[alpine1] Starting up..."; + sleep 10000; + resources: + requests: + cpu: "100m" + memory: "64Mi" + limits: + cpu: "250m" + memory: "128Mi" + securityContext: + runAsNonRoot: true + allowPrivilegeEscalation: false + + - name: alpine2 + image: alpine:latest + command: ["/bin/sh", "-c"] + args: + - | + echo "[alpine2] Starting up..."; + sleep 10000; + resources: + requests: + cpu: "100m" + memory: "64Mi" + limits: + cpu: "250m" + memory: "128Mi" + securityContext: + runAsNonRoot: true + allowPrivilegeEscalation: false + dnsPolicy: ClusterFirst restartPolicy: Never -#status: {} diff --git a/alpine/alpine-pod-service-account.yaml b/alpine/alpine-pod-service-account.yaml index c182125..5628de1 100644 --- a/alpine/alpine-pod-service-account.yaml +++ b/alpine/alpine-pod-service-account.yaml @@ -1,20 +1,28 @@ apiVersion: v1 kind: Pod metadata: - #creationTimestamp: null - labels: - run: alpine-sa name: alpine-sa + labels: + app: alpine-sa spec: serviceAccountName: mysa containers: - - args: - - /bin/sh - - -c - - echo hello;sleep 3600 - image: alpine - name: alpine-2-containers - # resources: {} + - name: alpine + image: alpine:latest + command: ["/bin/sh", "-c"] + args: + - | + echo "[INFO] Starting container with ServiceAccount: mysa"; + sleep 3600; + resources: + limits: + memory: "64Mi" + cpu: "250m" + requests: + memory: "32Mi" + cpu: "100m" + securityContext: + runAsNonRoot: true + allowPrivilegeEscalation: false dnsPolicy: ClusterFirst restartPolicy: Never -#status: {} diff --git a/alpine/alpine-pod-share-volumes.yaml b/alpine/alpine-pod-share-volumes.yaml index 7b44799..0b00439 100644 --- a/alpine/alpine-pod-share-volumes.yaml +++ b/alpine/alpine-pod-share-volumes.yaml @@ -1,32 +1,41 @@ apiVersion: v1 kind: Pod metadata: - labels: - run: alpine-2-containers name: alpine-2-containers-share-volume + labels: + app: alpine-volume-demo spec: containers: - - args: - - /bin/sh - - -c - - echo hello;sleep 10000 - image: alpine - name: alpine1 - volumeMounts: - - name: share - mountPath: "/tmp/share1" - - args: - - /bin/sh - - -c - - echo hello;sleep 10000 - image: alpine - name: alpine2 - volumeMounts: - - name: share - mountPath: "/tmp/share2" - dnsPolicy: ClusterFirst - restartPolicy: Never + - name: writer + image: alpine + command: ["/bin/sh", "-c"] + args: + - | + echo "[Writer] Writing to shared volume..."; + echo "Shared data from writer" > /shared/message.txt; + echo "[Writer] Sleeping..."; + sleep 10000; + volumeMounts: + - name: shared-volume + mountPath: /shared + + - name: reader + image: alpine + command: ["/bin/sh", "-c"] + args: + - | + echo "[Reader] Waiting for message..."; + sleep 5; + cat /shared/message.txt || echo "No message found!"; + echo "[Reader] Sleeping..."; + sleep 10000; + volumeMounts: + - name: shared-volume + mountPath: /shared + volumes: - - name: share + - name: shared-volume emptyDir: {} -#status: {} + + dnsPolicy: ClusterFirst + restartPolicy: Never diff --git a/alpine/alpine-pod.yaml b/alpine/alpine-pod.yaml index 2c3b7aa..1673c32 100644 --- a/alpine/alpine-pod.yaml +++ b/alpine/alpine-pod.yaml @@ -1,19 +1,27 @@ apiVersion: v1 kind: Pod metadata: - #creationTimestamp: null - labels: - run: alpine-2-containers name: alpine-2-containers + labels: + app: alpine-2-containers spec: containers: - - args: - - /bin/sh - - -c - - echo hello;sleep 3600 - image: alpine - name: alpine-2-containers - #resources: {} + - name: alpine + image: alpine:latest + command: ["/bin/sh", "-c"] + args: + - | + echo "[alpine] Hello from container"; + sleep 3600; + resources: + requests: + memory: "32Mi" + cpu: "100m" + limits: + memory: "64Mi" + cpu: "250m" + securityContext: + runAsNonRoot: true + allowPrivilegeEscalation: false dnsPolicy: ClusterFirst restartPolicy: Never -#status: {} diff --git a/configmap/configmap.yaml b/configmap/configmap.yaml index 2e064b3..4112b2d 100644 --- a/configmap/configmap.yaml +++ b/configmap/configmap.yaml @@ -7,7 +7,7 @@ data: database: "mydatabase" site.settings: | color=blue - padding:25px + padding: 25px --- apiVersion: v1 kind: Pod @@ -15,24 +15,36 @@ metadata: name: configmappod spec: containers: - - name: configmapcontainer - image: nginx - env: - - name: DB_SERVER - valueFrom: - configMapKeyRef: - name: myconfigmap - key: db_server - - name: DATABASE - valueFrom: - configMapKeyRef: - name: myconfigmap - key: database - volumeMounts: - - name: config-vol - mountPath: "/config" - readOnly: true + - name: configmapcontainer + image: nginx + env: + - name: DB_SERVER + valueFrom: + configMapKeyRef: + name: myconfigmap + key: db_server + - name: DATABASE + valueFrom: + configMapKeyRef: + name: myconfigmap + key: database + volumeMounts: + - name: config-vol + mountPath: "/config" + readOnly: true volumes: - name: config-vol configMap: - name: myconfigmap \ No newline at end of file + name: myconfigmap + items: + - key: site.settings + path: "site.settings" # Mount only the relevant file from the ConfigMap + restartPolicy: Always + dnsPolicy: ClusterFirst + securityContext: + runAsNonRoot: true + allowPrivilegeEscalation: false + terminationGracePeriodSeconds: 30 + hostNetwork: false + hostIPC: false + hostPID: false diff --git a/daemonset/daemonset.yaml b/daemonset/daemonset.yaml index 2e2a995..33df6dc 100644 --- a/daemonset/daemonset.yaml +++ b/daemonset/daemonset.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: DaemonSet metadata: name: logdaemonset + namespace: logging # Specify the namespace labels: app: fluentd-logging spec: @@ -14,9 +15,8 @@ spec: name: fluentd-elasticsearch spec: tolerations: - # this toleration is to have the daemonset runnable on master nodes - # remove it if your masters can't run pods - - key: node-role.kubernetes.io/master + # Allow the DaemonSet to run on control-plane nodes + - key: node-role.kubernetes.io/control-plane effect: NoSchedule containers: - name: fluentd-elasticsearch @@ -33,6 +33,22 @@ spec: - name: varlibdockercontainers mountPath: /var/lib/docker/containers readOnly: true + securityContext: + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + livenessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 10 + periodSeconds: 10 + readinessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 5 + periodSeconds: 5 terminationGracePeriodSeconds: 30 volumes: - name: varlog @@ -40,4 +56,4 @@ spec: path: /var/log - name: varlibdockercontainers hostPath: - path: /var/lib/docker/containers \ No newline at end of file + path: /var/lib/docker/containers diff --git a/dashboards/dashy/dashy.yml b/dashboards/dashy/dashy.yml index 4a8dcd9..72fecd9 100644 --- a/dashboards/dashy/dashy.yml +++ b/dashboards/dashy/dashy.yml @@ -1,8 +1,10 @@ - apiVersion: v1 kind: PersistentVolumeClaim metadata: name: dashy + namespace: dashy-namespace + labels: + app: dashy spec: accessModes: - ReadWriteMany @@ -14,6 +16,9 @@ apiVersion: apps/v1 kind: Deployment metadata: name: dashy + namespace: dashy-namespace + labels: + app: dashy spec: replicas: 1 selector: @@ -32,16 +37,37 @@ spec: volumeMounts: - mountPath: /app/public/ name: dashy + resources: + requests: + memory: "256Mi" + cpu: "250m" + limits: + memory: "512Mi" + cpu: "500m" + readinessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 10 + periodSeconds: 15 volumes: - name: dashy persistentVolumeClaim: claimName: dashy --- -# A Single-use pod to create the content of /app/public in the PV apiVersion: v1 kind: Pod metadata: name: dashy-seeder + namespace: dashy-namespace + labels: + app: dashy spec: restartPolicy: OnFailure containers: @@ -52,6 +78,13 @@ spec: volumeMounts: - mountPath: /mnt/public name: dashy-seeder + resources: + requests: + memory: "128Mi" + cpu: "100m" + limits: + memory: "256Mi" + cpu: "200m" volumes: - name: dashy-seeder persistentVolumeClaim: @@ -61,10 +94,14 @@ apiVersion: v1 kind: Service metadata: name: dashy + namespace: dashy-namespace + labels: + app: dashy spec: ports: - port: 80 nodePort: 30004 + targetPort: 80 selector: app: dashy type: NodePort diff --git a/dashboards/heimdall/heimdall.yml b/dashboards/heimdall/heimdall.yml index a890249..1ef803d 100644 --- a/dashboards/heimdall/heimdall.yml +++ b/dashboards/heimdall/heimdall.yml @@ -2,6 +2,9 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: heimdall + namespace: heimdall-namespace # Added namespace + labels: + app: heimdall # Added label for consistency spec: accessModes: - ReadWriteMany @@ -13,6 +16,9 @@ apiVersion: apps/v1 kind: Deployment metadata: name: heimdall + namespace: heimdall-namespace # Added namespace + labels: + app: heimdall # Added label for consistency spec: replicas: 1 selector: @@ -42,11 +48,33 @@ spec: volumeMounts: - mountPath: /config name: heimdall + resources: # Added resource limits and requests + limits: + memory: "512Mi" + cpu: "500m" + requests: + memory: "256Mi" + cpu: "250m" + readinessProbe: # Added readiness probe + httpGet: + path: / + port: 80 + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: # Added liveness probe + httpGet: + path: / + port: 80 + initialDelaySeconds: 15 + periodSeconds: 20 --- apiVersion: v1 kind: Service metadata: name: heimdall + namespace: heimdall-namespace # Added namespace + labels: + app: heimdall # Added label for consistency spec: ports: - port: 80 diff --git a/dashboards/homarr/homarr.yml b/dashboards/homarr/homarr.yml index 1135289..d1d12ca 100644 --- a/dashboards/homarr/homarr.yml +++ b/dashboards/homarr/homarr.yml @@ -2,6 +2,9 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: homarr-configs + namespace: homarr + labels: + app: homarr spec: accessModes: - ReadWriteMany @@ -13,6 +16,9 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: homarr-icons + namespace: homarr + labels: + app: homarr spec: accessModes: - ReadWriteMany @@ -24,6 +30,9 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: homarr-data + namespace: homarr + labels: + app: homarr spec: accessModes: - ReadWriteOnce @@ -35,6 +44,9 @@ apiVersion: apps/v1 kind: Deployment metadata: name: homarr + namespace: homarr + labels: + app: homarr spec: replicas: 1 selector: @@ -50,9 +62,16 @@ spec: image: ghcr.io/ajnart/homarr:0.14.4 ports: - containerPort: 7575 - env: - - name: PASSWORD - value: mypassword + envFrom: + - secretRef: + name: homarr-secret + resources: + requests: + memory: "256Mi" + cpu: "250m" + limits: + memory: "512Mi" + cpu: "500m" volumeMounts: - mountPath: /data name: homarr-data @@ -60,6 +79,18 @@ spec: name: homarr-configs - mountPath: /app/public/icons name: homarr-icons + readinessProbe: + httpGet: + path: / + port: 7575 + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + httpGet: + path: / + port: 7575 + initialDelaySeconds: 10 + periodSeconds: 20 volumes: - name: homarr-configs persistentVolumeClaim: @@ -75,10 +106,22 @@ apiVersion: v1 kind: Service metadata: name: homarr + namespace: homarr + labels: + app: homarr spec: ports: - port: 7575 - nodePort: 30008 + targetPort: 7575 selector: app: homarr - type: NodePort + type: ClusterIP +--- +apiVersion: v1 +kind: Secret +metadata: + name: homarr-secret + namespace: homarr +type: Opaque +data: + PASSWORD: bXlwYXNzd29yZA== # Base64 encoded value of "mypassword" diff --git a/database-management/adminer/adminer.yml b/database-management/adminer/adminer.yml index e50e03f..b472279 100644 --- a/database-management/adminer/adminer.yml +++ b/database-management/adminer/adminer.yml @@ -2,6 +2,8 @@ apiVersion: apps/v1 kind: Deployment metadata: name: adminer + labels: + app: adminer spec: replicas: 1 selector: @@ -14,18 +16,40 @@ spec: spec: containers: - name: adminer - image: adminer + image: adminer:4.8.1 # Specify a version tag ports: - containerPort: 8080 + resources: + requests: + memory: "128Mi" + cpu: "250m" + limits: + memory: "256Mi" + cpu: "500m" + livenessProbe: + httpGet: + path: / + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 10 + readinessProbe: + httpGet: + path: / + port: 8080 + initialDelaySeconds: 5 + periodSeconds: 10 --- apiVersion: v1 kind: Service metadata: name: adminer + labels: + app: adminer spec: ports: - port: 8080 + targetPort: 8080 nodePort: 30433 selector: app: adminer diff --git a/database-management/cloudBeaver/cloudBeaver.yml b/database-management/cloudBeaver/cloudBeaver.yml index 96db987..edc26a8 100644 --- a/database-management/cloudBeaver/cloudBeaver.yml +++ b/database-management/cloudBeaver/cloudBeaver.yml @@ -2,6 +2,9 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: cloudbeaver + namespace: database-management + labels: + app: cloudbeaver spec: accessModes: - ReadWriteOnce @@ -13,6 +16,9 @@ apiVersion: apps/v1 kind: Deployment metadata: name: cloudbeaver + namespace: database-management + labels: + app: cloudbeaver spec: replicas: 1 selector: @@ -35,16 +41,38 @@ spec: volumeMounts: - mountPath: /opt/cloudbeaver/workspace name: workspace - + resources: + requests: + memory: "512Mi" + cpu: "500m" + limits: + memory: "1Gi" + cpu: "1" + readinessProbe: + httpGet: + path: / + port: 8978 + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + httpGet: + path: / + port: 8978 + initialDelaySeconds: 15 + periodSeconds: 20 --- apiVersion: v1 kind: Service metadata: name: cloudbeaver + namespace: database-management + labels: + app: cloudbeaver spec: ports: - port: 8978 - nodePort: 30433 + targetPort: 8978 + nodePort: 30433 # Use only if NodePort is required selector: app: cloudbeaver - type: NodePort + type: NodePort # Change to ClusterIP if external access is not needed diff --git a/database-management/pgadmin/pgadmin.yml b/database-management/pgadmin/pgadmin.yml index d0b9bdf..509b69d 100644 --- a/database-management/pgadmin/pgadmin.yml +++ b/database-management/pgadmin/pgadmin.yml @@ -3,6 +3,9 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: pgadmin + namespace: database-management + labels: + app: pgadmin spec: accessModes: - ReadWriteOnce @@ -14,6 +17,9 @@ apiVersion: apps/v1 kind: Deployment metadata: name: pgadmin + namespace: database-management + labels: + app: pgadmin spec: replicas: 1 selector: @@ -25,20 +31,32 @@ spec: app: pgadmin spec: containers: - - env: + - name: pgadmin + image: dpage/pgadmin4 + ports: + - containerPort: 80 + env: - name: PGADMIN_DEFAULT_EMAIL value: admin@example.com - name: PGADMIN_DEFAULT_PASSWORD value: keyboardcat - name: PGADMIN_PORT value: "80" - image: dpage/pgadmin4 - name: pgadmin - ports: - - containerPort: 80 volumeMounts: - mountPath: /var/lib/pgadmin name: pgadmin + readinessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + httpGet: + path: / + port: 80 + initialDelaySeconds: 15 + periodSeconds: 20 volumes: - name: pgadmin persistentVolumeClaim: @@ -47,13 +65,14 @@ spec: apiVersion: v1 kind: Service metadata: + name: pgadmin + namespace: database-management labels: app: pgadmin - name: pgadmin spec: ports: - - nodePort: 30165 - port: 80 + - port: 80 + targetPort: 80 selector: app: pgadmin - type: NodePort + type: ClusterIP diff --git a/databases/influxdb/influxdb.yml b/databases/influxdb/influxdb.yml index 6500c99..bb41ac5 100644 --- a/databases/influxdb/influxdb.yml +++ b/databases/influxdb/influxdb.yml @@ -2,17 +2,20 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: influxdb + namespace: databases spec: accessModes: - ReadWriteOnce resources: requests: storage: 10Gi + storageClassName: standard --- apiVersion: apps/v1 kind: Deployment metadata: name: influxdb + namespace: databases spec: replicas: 1 selector: @@ -25,7 +28,7 @@ spec: spec: containers: - name: influxdb - image: influxdb + image: influxdb:2.7.1 ports: - containerPort: 8086 volumeMounts: @@ -42,6 +45,25 @@ spec: value: my_org - name: DOCKER_INFLUXDB_INIT_BUCKET value: my_bucket + resources: + requests: + memory: "512Mi" + cpu: "500m" + limits: + memory: "1Gi" + cpu: "1" + readinessProbe: + httpGet: + path: /health + port: 8086 + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + httpGet: + path: /health + port: 8086 + initialDelaySeconds: 10 + periodSeconds: 20 volumes: - name: influxdb persistentVolumeClaim: @@ -51,10 +73,11 @@ apiVersion: v1 kind: Service metadata: name: influxdb + namespace: databases spec: ports: - port: 8086 - nodePort: 30886 + targetPort: 8086 selector: app: influxdb - type: NodePort + type: ClusterIP diff --git a/databases/mongodb/mongodb.yml b/databases/mongodb/mongodb.yml index abf73a3..c1016b2 100644 --- a/databases/mongodb/mongodb.yml +++ b/databases/mongodb/mongodb.yml @@ -2,6 +2,9 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mongo + namespace: databases # Added namespace + labels: + app: mongo spec: accessModes: - ReadWriteOnce @@ -13,6 +16,9 @@ apiVersion: apps/v1 kind: Deployment metadata: name: mongo + namespace: databases # Added namespace + labels: + app: mongo spec: replicas: 1 selector: @@ -35,14 +41,41 @@ spec: volumeMounts: - mountPath: /data/db name: mongo + resources: # Added resource limits and requests + limits: + memory: "512Mi" + cpu: "500m" + requests: + memory: "256Mi" + cpu: "250m" + livenessProbe: # Added liveness probe + exec: + command: + - mongo + - --eval + - "db.adminCommand('ping')" + initialDelaySeconds: 30 + periodSeconds: 10 + readinessProbe: # Added readiness probe + exec: + command: + - mongo + - --eval + - "db.adminCommand('ping')" + initialDelaySeconds: 5 + periodSeconds: 10 --- apiVersion: v1 kind: Service metadata: name: mongo + namespace: databases # Added namespace + labels: + app: mongo spec: ports: - port: 27017 + targetPort: 27017 nodePort: 30217 selector: app: mongo diff --git a/databases/mysql/mysql.yml b/databases/mysql/mysql.yml index fe34776..69b4e63 100644 --- a/databases/mysql/mysql.yml +++ b/databases/mysql/mysql.yml @@ -2,6 +2,8 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: mysql + labels: + app: mysql spec: accessModes: - ReadWriteOnce @@ -13,6 +15,8 @@ apiVersion: apps/v1 kind: Deployment metadata: name: mysql + labels: + app: mysql spec: replicas: 1 selector: @@ -29,30 +33,63 @@ spec: claimName: mysql containers: - name: mysql - image: mysql + image: mysql:latest ports: - containerPort: 3306 - env: - - name: MYSQL_ROOT_PASSWORD - value: keyboardcat - - name: MYSQL_DATABASE - value: myDb - - name: MYSQL_USER - value: myuser - - name: MYSQL_PASSWORD - value: mypassword + envFrom: + - secretRef: + name: mysql-secret volumeMounts: - mountPath: /var/lib/mysql name: mysql + resources: + requests: + memory: "512Mi" + cpu: "500m" + limits: + memory: "1Gi" + cpu: "1" + readinessProbe: + exec: + command: + - mysqladmin + - ping + - "-h" + - "127.0.0.1" + initialDelaySeconds: 5 + periodSeconds: 10 + livenessProbe: + exec: + command: + - mysqladmin + - ping + - "-h" + - "127.0.0.1" + initialDelaySeconds: 30 + periodSeconds: 10 --- apiVersion: v1 kind: Service metadata: name: mysql + labels: + app: mysql spec: ports: - port: 3306 - nodePort: 30306 selector: app: mysql - type: NodePort + type: ClusterIP +--- +apiVersion: v1 +kind: Secret +metadata: + name: mysql-secret + labels: + app: mysql +type: Opaque +data: + MYSQL_ROOT_PASSWORD: a2V5Ym9hcmRjYXQ= # Base64 encoded value of 'keyboardcat' + MYSQL_DATABASE: bXlEYg== # Base64 encoded value of 'myDb' + MYSQL_USER: bXl1c2Vy # Base64 encoded value of 'myuser' + MYSQL_PASSWORD: bXlwYXNzd29yZA== # Base64 encoded value of 'mypassword'