# Cisco Meraki Day 1 11/02/2020 ## Trainers [Rafael Tanaka](mailto:rafael.tanaka@jetstack.io) ## Setup | Meeting ID | Password | | ---------- | ---------- | | Zoom | to confirm | ### Links - [Download Zoom](https://zoom.us/download#client_4meeting) - [FlightDeck](https://flightdeck.jetstack.io) - you should have recieved an invitation email ## Schedule | | | |--|--| |Start|9:30| |Morning break|11:00-11:10| |Lunch|12:15-13:15| |Afternoon break|15:10-15:20| |Finish|17:00| ## Attendee Resources ## Comments TIL [ndots resolv.conf option](https://pracucci.com/kubernetes-dns-resolution-ndots-options-and-why-it-may-affect-application-performances.html) Simon's challenge-app.yml ```yaml apiVersion: v1 kind: Pod metadata: name: sample-web labels: app: config spec: containers: - image: gcr.io/jetstack-workshops/sample-web:configmap name: challenge-app env: - name: MYSECRET valueFrom: secretKeyRef: key: secretenv name: mysecret - name: MYVAR valueFrom: configMapKeyRef: key: my-config name: MYVAR <<<< it should be "myvars" ``` ```yaml controlplane $ cat /root/manifests/myvars.yaml apiVersion: v1 data: MYVAR: IAmJustAnEnv var.txt: I came from the filesystem kind: ConfigMap metadata: creationTimestamp: null name: my-config ``` ```bash controlplane $ kubectl apply -f /root/manifests/challenge-app.yaml The Pod "sample-web" is invalid: spec.containers[0].env[1].valueFrom.configMapKeyRef.name: Invalid value: "MYVAR": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*') ``` ConfigMap object: ```yaml= apiVersion: v1 data: MYVAR: IAmJustAnEnv var.txt: I came from the filesystem kind: ConfigMap metadata: creationTimestamp: null name: myvars ``` Pod object (Step 4): ```yaml= apiVersion: v1 kind: Pod metadata: name: sample-web labels: app: config spec: containers: - image: gcr.io/jetstack-workshops/sample-web:configmap name: challenge-app env: - name: MYSECRET valueFrom: secretKeyRef: key: secretenv name: mysecret - name: MYVAR valueFrom: configMapKeyRef: key: MYVAR name: myvars ``` Pod Object (Step 5) ```yaml= apiVersion: v1 kind: Pod metadata: name: sample-web labels: app: config spec: volumes: - name: varfile configMap: name: myvars items: - key: var.txt path: var.txt containers: - image: gcr.io/jetstack-workshops/sample-web:configmap name: challenge-app env: - name: MYSECRET valueFrom: secretKeyRef: key: secretenv name: mysecret - name: MYVAR valueFrom: configMapKeyRef: key: MYVAR name: myvars volumeMounts: - name: varfile mountPath: /data/ ``` https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-terminating-with-grace --- alex ```yaml= apiVersion: apps/v1 kind: Deployment metadata: name: shippingservice spec: selector: matchLabels: app: shippingservice template: metadata: labels: app: shippingservice spec: containers: - name: server image: gcr.io/google-samples/microservices-demo/shippingservice:v0.2.1 ports: - containerPort: 50051 env: - name: PORT value: "50051" - name: DISABLE_STATS value: "1" - name: DISABLE_TRACING value: "1" - name: DISABLE_PROFILER value: "1" readinessProbe: periodSeconds: 5 exec: command: ["/bin/grpc_health_probe", "-addr=:50051"] livenessProbe: exec: command: ["/bin/grpc_health_probe", "-addr=:50051"] # resources: # requests: # cpu: 100m # memory: 64Mi # limits: # cpu: 200m # memory: 128Mi ``` CronJob Workshop (It's about time) ```yaml= apiVersion: batch/v1beta1 kind: CronJob metadata: creationTimestamp: null name: crontest spec: jobTemplate: metadata: creationTimestamp: null name: crontest spec: template: metadata: creationTimestamp: null spec: containers: - command: - /bin/sh - -c - curl -X POST -d cron=job https://webhook.site/YOUR-STRING-HERE image: curlimages/curl:7.74.0 name: crontest resources: {} restartPolicy: OnFailure schedule: "* * * * *" status: {} ``` Feedback form: https://docs.google.com/forms/d/1wUi68Xqeby_lOy1x6vUUW8YslXUGHe3DHXLC3j2wJBs/edit?gxids=7628