Skip to content

Instantly share code, notes, and snippets.

View antweiss's full-sized avatar

Ant Weiss antweiss

View GitHub Profile
- Create a new namespace in your cluster named "recap"
- Switch your context to use the namespace 'recap'
- Create a Deployment using the following command:
`kubectl create deployment apache --image=httpd`
- Verify the pod for the deployment is running
- Expose your deployment as a service named `apache` on port 80
- Dump the Deployment `apache` to a **apache.yaml** file
- Edit the **apache.yaml**:
- Add a volume named `html` to the pod template spec
- Mount the volume into the `httpd` container at `/usr/local/apache2/htdocs/`
#! /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 \
kubectl patch svc webui --type=merge -p '{"spec": {"ports":[{"nodePort": 12345, "port": 80, "targetPort": 80}]}}'
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
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: echo
name: echo
spec:
replicas: 1
selector:
matchLabels:
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: traefik-ingress-controller
namespace: kube-system
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
@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:

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.

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.

apiVersion: v1
kind: Service
metadata:
name: nginx
namespace: orange
labels:
app: nginx
spec:
ports:
- port: 80