-
Notifications
You must be signed in to change notification settings - Fork 144
Kubernetes
Mehdi Hadeli edited this page Sep 18, 2023
·
62 revisions
- How to set helpful aliases for Kubernetes commands in Ubuntu 20.04 ⭐
- Daily useful Kubernetes aliases ⭐
- Kubernetes NodePort vs LoadBalancer vs Ingress? When should I use what? ⭐
- How to Make the Most of Kubernetes Environment Variables
- Kubernetes equivalent of env-file in Docker
- Managing Secrets using Configuration File
- Define Dependent Environment Variables ⭐
- Define Environment Variables for a Container
- Understanding Kubernetes services & ingress networking ⭐
- Combining Ingress Controllers and External Load Balancers with Kubernetes
- Configure SSL certificate with cert-manager on Kubernetes
- Installing Cert manager with Helm
- SelfSigned Cert with Cert Manager
- Using a Network Load Balancer with the NGINX Ingress Controller on Amazon EKS ⭐
- What is a Kubernetes Ingress Controller, and How is it Different from a Kubernetes Ingress? ⭐
- Using NGINX or NGINX Plus as the Ingress Controller for Amazon Elastic Kubernetes Services
- ConfigMaps - Docs ⭐
- Secrets - Docs ⭐
- Distribute Credentials Securely Using Secrets - Docs ⭐⭐
- Configure a Pod to Use a ConfigMap - Docs ⭐⭐
- Kubernetes–Override an appsettings.json file in an ASP.NET Core app through ConfigMaps
- Kubernetes - Reload your ASP.NET Core configuration when a configmap changes–DOTNET_USE_POLLING_FILE_WATCHER
- Hot-Reload .NET Configuration in Kubernetes with ConfigMaps ⭐⭐
- Managing Resources ⭐
- How to use environment variables in a Kubernetes manifest ⭐⭐
- How to quickly replace environment variables in a file ⭐
- Using envsubst to Merge Environment Variables into Config Files
- Service ⭐
- Pods
- Ingress
- Annotations
- Labels and Selectors ⭐
- Field Selectors ⭐
- Recommended Labels ⭐
- Well-Known Labels, Annotations and Taints
- Using labels effectively
- Why K8s deployments need
matchLabels
keyword - The Guide to Kubernetes Labels ⭐⭐
- Kubernetes Error Codes: Field Is Immutable
- Use Port Forwarding to Access Applications in a Cluster
- Difference between kubectl port-forwarding and NodePort service
- Configure Liveness, Readiness and Startup Probes ⭐
- kubernetes supports
substitute
andreplace
environment variable in kubernetes resource files but it only works for env section of our resource, actually we can use$(VAR_NAME)
in thevalue
ofenv
attribute in the resource file. but we want to use environment variables in all attribute so we useenvsubst
approach. Then define theseenvironment variables
either by defining them in theshell session
(will destroy after closing shell) or save them to a file (e.g..env
)
export SERVER_URL=https://gitlab.com/test
export USER_NAME=foo_user
export USER_PASSWORD=test
then loading them into your current shell session
by using source .env
, then our resource will substitute with envsubst < input.tmpl > output.text
(it is also possible to write your substitution to a new file). It is possible to pipe the output into other commands like less
or kubectl
for Kubernetes for example envsubst < deploy.yml | kubectl apply -f -
.
-
load balancer
service type for choosing one node on the cluster and connect to node port on the cluster node, if we want for each service in our node create a separated load balancer service type it should allocate separate ip for that and with this ip connect to a node port on the cluster and then connect to internal service and container and it is expensive. - if we have to add one more service to our node and access it from another URL. In this case, we will have to add another load balancer to our cluster. This means that each service exposed with a LoadBalancer will get its own IP address and we will have to pay for each of these load balancers which can be quite expensive.
- Ingress is not actually a type of service. Instead, it is an entry point that sits in front of multiple services in the cluster. It can be defined as a collection of routing rules that govern how external users access services running inside a Kubernetes cluster.
- we use
traefik
behind aload balancer
service type, for load balancing between nodes and then use ingress for route traefik internal to each node - According to the Kubernetes documentation, it is recommended to put resources related to the same microservice or application tier into the same file[1]. This helps in organizing and managing resources more efficiently. It also makes it easier to understand and maintain the configuration files.
- we can skip the company.com
prefix
if we don’t intend todistribute
our resources outside of our company (as long as we don’t expect anaming conflict
with another third-party package installed in our environment using thesame label
without aprefix
). - we can visualize and manage Kubernetes objects with more tools than kubectl and the dashboard. A common set of labels allows tools to work interoperably, describing objects in a common manner that all tools can understand.
- Shared labels and annotations share a common prefix:
app.kubernetes.io
. Labelswithout
a prefix areprivate
to users. The shared prefix ensures that shared labels do notinterfere
withcustom user labels
. - The
.spec.selector
field in deployment defines how the created ReplicaSet finds which Pods tomanage
. In this case, we use set-based label selector to select matchLabels labels, and finding pods for these labels (pods labels defined in the podtemplate
section) - matchLabels is a Set-based label selector
-
matchLabels
is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of `matchExpressions``, whose key field is "key", the operator is "In", and the values array contains only "value". - find resources with label selector
kubectl get pods -l environment=production,tier=frontend
-
kubectl port-forward
allows using resource name, such as apod name
orservice name
, and forwards its port tolocal port
or actuallyhttp://127.0.0.1:<Forward_Port>
orhttp://localhost:<Forward_Port>
or localhost ping ->[::1]:<Forward_Port>
- https://github.com/telepresenceio/telepresence
- https://github.com/garden-io/garden
- https://github.com/kubernetes-sigs/kustomize
- Local Kubernetes Development with Telepresence
- Building Microservice Systems Without Cooking Your Laptop
- Getting started with Garden Part1
- See Garden.io in Action | Platform Demo
- Kubernetes Ingress Explained (2 Types)
- https://github.com/baotoq/micro-commerce
- https://github.com/thangchung/shopping-cart-k8s
- https://github.com/twzhangyang/RestAirline
- https://github.com/microservices-demo/microservices-demo
- https://github.com/vany0114/microservices-dotnetcore-docker-sf-k8s
- https://github.com/thangchung/shopping-cart-k8s
- https://github.com/ContainerSolutions/k8s-deployment-strategies
- https://github.com/arashkaffamanesh/practical-kubernetes-problems
- https://github.com/vietnam-devs/coolstore-microservices/deploys
- https://github.com/mikehadlow/NetOnKubernetes
- https://github.com/stefanprodan/podinfo
- https://github.com/fluxcd/flux2-kustomize-helm-example
- https://github.com/WolfgangOfner/MicroserviceDemo
- https://github.com/bravecobra/k8s-dev-infrastructure ⭐
- https://github.com/HighwayofLife/kubernetes-validation-tools
- https://github.com/open-policy-agent/conftest
- https://github.com/stelligent/config-lint
- https://github.com/yannh/kubeconform
- https://github.com/FairwindsOps/polaris
- https://github.com/komodorio/validkube
- Kubernetes: Merge Multiple YAML Files Into One
- Kubernetes: Change base YAML config for different environments prod/test using Kustomize
- Managing kubernetes environments with kustomize
- Kustomize Tutorial: Comprehensive Guide For Beginners ⭐⭐
- How to Create Helm Chart [Comprehensive Beginners Guide] ⭐⭐
- Combining Helm and Kustomize: When, Why, and How?
- Helm vs Kustomize: why, when, and how
- When and How to Use Helm and Kustomize Together
- https://github.com/marcel-dempers/docker-development-youtube-series/tree/master/kubernetes/kustomize
- https://github.com/fluxcd/flux2-kustomize-helm-example
- Introduction to Helm | Kubernetes Tutorial | Beginners Guide
- Package Management with Helm // Kubernetes Tutorial
- What is Helm in Kubernetes? Helm and Helm Charts explained
- Helm vs Kustomize - The Fight Between Templating and Patching in Kubernetes
- komodorio/helm-dashboard - The missing UI for Helm - visualize your releases
- https://github.com/okteto/movies-with-helm
- https://github.com/fluxcd/flux2-kustomize-helm-example
- https://github.com/dotnet-architecture/eShopOnContainers/tree/dev/deploy/k8s/helm
- https://github.com/thinktecture-labs/cloud-native-sample