This is a common question that comes up. How should we name our Kubernetes namespaces and app names.
Will show my opinion on this and how to best manage and organize your application in Kubernetes namespaces. I walk through the evolution process that folks go through, and also provide a full blow demo what happens when you use the different naming conventions.
Typical Naming Strategy Evolution:
- Default Namespace: Pile of Trash Strategy
- App Namespace: Scope by App. Cons: No security isolation between dev and prod.
- Env Namespace: Scope by Env. Cons: As number of apps grow the env becomes pretty noisy.
- App-Env Namespace: Scope by both app and env.
Demo
Actual created 4 EKS clusters and deployed resources with all 4 strategies to really show the differences. The EKS Clusters.
- eks-default
- eks-app
- eks-env
- eks-app-env
Links
Note: Wanted to also mentioned that prod and dev should be in separate clusters entirely. However, the naming strategy should still be the same and include the env. IE: namespace = app1-dev
.
The reason is because it’s common to have multiple envs in a common dev
or non-prod
cluster. By keeping the env in the namespace naming strategy, it's consistent for when the case comes up that folks want multiple environments in the same cluster, since there's some maintenance overhead that comes with managing each cluster.
Kubernetes Intro
1h 43m
Explore lesson as part of a learning path
Get full access to these great resources
All for less than the price of coffee a day