Sha256: 6984f5bc8badf1667e0336fb9dd79abfccb66d56da3c50e04672c5f7969f0b92
Contents?: true
Size: 1.21 KB
Versions: 37
Compression:
Stored size: 1.21 KB
Contents
--- title: YAML Example --- Kubes provides helper methods to make creating extra environments easy: `with_extra`. We'll create extra environments under different namespaces. Here's how you achieve extra environments with the YAML form: .kubes/resources/web/deployment.rb ```ruby --- apiVersion: apps/v1 kind: Deployment metadata: name: demo-web labels: app: demo namespace: <%= with_extra("default") %> spec: replicas: 2 selector: matchLabels: app: demo template: metadata: labels: app: demo spec: containers: - image: <%= docker_image %> name: demo-web ``` .kubes/resources/web/service.rb ```ruby --- apiVersion: v1 kind: Service metadata: name: demo-web labels: app: demo namespace: <%= with_extra("default") %> spec: ports: - port: 80 protocol: TCP targetPort: 8080 selector: app: demo type: NodePort ``` It's important to use the `with_extra` helper to set the namesapce. The helper accounts for `KUBES_EXTRA` and appends the value. ## Deployment Then to create an additional environment, it's simple: kubectl create ns default-2 KUBES_EXTRA=2 kubes deploy To check on the resources: kubectl get all -n default-2
Version data entries
37 entries across 37 versions & 1 rubygems