organic-stem-skeleton v3 based k8s related utilities.
- mngmt of k8s resource manifests with dna templating features
- automatic use of
repoRoot/.kubeconfig
- automatic
app=cellName
labeling for k8s logs
cd cells/myCell
npm i angelscripts-stem-k8s --save-dev
k8s apply
, k8s delete
and k8s get
commands are enchanced version of their respective version at kubectl
with the following:
- if there is
repoRoot/.kubeconfig
, it is used - passed argument is cell's dna branch dot notated path which represent a k8s manifest for resource with DNA support for templating.
$ cd cells/myCell
$ edit ./dna/k8s/deployment.yaml
$ edit package.json
$ npx angel k8s apply k8s.deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{$npm_package_name}-deployment"
labels:
app: "{$npm_package_name}"
spec:
replicas: 1
selector:
matchLabels:
app: "{$npm_package_name}"
template:
metadata:
labels:
app: "{$npm_package_name}"
spec:
containers:
- name: "{$npm_package_name}"
image: "@{cells.cell89.registry}/{$npm_package_name}-{$npm_package_version}"
ports:
- containerPort: "@cells.cell89.port"
resources:
limits:
cpu: "1"
memory: 1024Mi
requests:
cpu: "50m"
memory: 256Mi
env:
- name: CELL_MODE
value: "_production+_secrets"
DNA branch dot notated paths separated by comma indicate multple k8s manifests to be managed.
$ cd cells/myCell
$ npx angel k8s apply k8s.deployment,k8s.service
To see how DNA branches are rendered as manifests use k8s yaml
command and provide a dot notated DNA branch path.
$ cd cells/myCell
$ npx angel k8s yaml k8s.deployment,k8s.service