Skip to content

Instantly share code, notes, and snippets.

View antweiss's full-sized avatar

Ant Weiss antweiss

View GitHub Profile
@antweiss
antweiss / api.py
Last active April 13, 2022 10:46
for prom training
import time
import logging
import random
from eve import Eve
from eve_swagger import swagger, add_documentation
from prometheus_client import start_http_server, Counter, Gauge, Histogram
app = Eve()
app.register_blueprint(swagger)
apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: orange
labels:
app: nginx
spec:
ports:
- port: 80

Create a Dockerfile Based on debian Inside the image - install ping Inside the image: echo your name into a file called /author Define the env variable host - set it to www.google.com And make the entrypoint of the container run ping By default it will ping the host specified by the env variable 'host' But one can pass another host to ping when running a container.

Exercise:
1. Please create a configmap with the following values:
```
NAME=<your name>
LASTNAME=<yourlastname>
COMPANY=Soluto
```
2. Run a deployment based on otomato/httpenv so that the configmap values are injected into the container environment.
@antweiss
antweiss / multistage-docker-exercise.md
Created December 14, 2021 16:21
Multistage Docker build exercise

In an empty directory on you machine create a hello.c file with the following content:

#include <stdio.h>
int main() {
   printf("Hello, Multistage!");
   return 0;
}

Now add a multi-stage Dockerfile that will:

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: traefik-ingress-controller
namespace: kube-system
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: echo
name: echo
spec:
replicas: 1
selector:
matchLabels:
curl -L https://raw.githubusercontent.com/jonmosco/kube-ps1/master/kube-ps1.sh -o $HOME/kube-ps1.sh && \
echo 'source $HOME/kube-ps1.sh' >> ~/.bashrc && \
echo "PS1='[\u@\h \W \$(kube_ps1)]\$ '" >> ~/.bashrc
kubectl patch svc webui --type=merge -p '{"spec": {"ports":[{"nodePort": 12345, "port": 80, "targetPort": 80}]}}'
#! /bin/bash -f
sudo apt-get update
#Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install -y apt-transport-https \
ca-certificates \
curl \
software-properties-common \
jq \