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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nginx | |
namespace: orange | |
labels: | |
app: nginx | |
spec: | |
ports: | |
- port: 80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
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:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: traefik-ingress-controller | |
namespace: kube-system | |
--- | |
kind: DaemonSet | |
apiVersion: apps/v1 | |
metadata: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: echo | |
name: echo | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl patch svc webui --type=merge -p '{"spec": {"ports":[{"nodePort": 12345, "port": 80, "targetPort": 80}]}}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 \ |