hostname
unshare -u bash
hostname testhost
hostname
exit
hostname
docker pull httpd:latest
docker save httpd:latest -o httpd.tar
mkdir httpd && tar -C httpd -xvf httpd.tar && cd httpd
ls
jq . manifest.json
jq . <config.json>
cd ./<path to a layer dir>
mkdir layer && tar -C layer -xvf layer.tar
ls -la layer
docker run -d -p 8080:80 --name nginx nginx
curl localhost:8080
docker kill nginx && docker rm nginx
cat << EOF > index.html
hello world
EOF
docker run -d -p 8080:80 -v ./index.html:/usr/share/nginx/html/index.html --name nginx nginx
curl localhost:8080
docker inspect nginx
docker inspect network bridge
docker run -d -p 8081:80 --name nginx2 nginx
docker inspect network bridge
docker kill nginx nginx2 && docker rm nginx nginx2
kubeadm init --apiserver-advertise-address $(hostname -i) --pod-network-cidr 10.5.0.0/16
kubectl apply -f https://raw.githubusercontent.com/cloudnativelabs/kube-router/master/daemonset/kubeadm-kuberouter.yaml
kubeadm join 192.168.0.7:6443 --token gdq1k6.3zodxzisbii1kbsh \
--discovery-token-ca-cert-hash sha256:39d0561a98d2c371c8ddda04d15a21cbbcff22a357e6356c9fd6fec1a49b194a
kubectl get -v 8 nodes
cat << EOF > nginx.yaml
apiVersion: v1
kind: Service
metadata:
name: my-nginx-svc
labels:
app: nginx
spec:
type: NodePort
ports:
- port: 80
selector:
app: nginx
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
EOF
kubectl create -f nginx.yaml
kubectl get svc
curl localhost:<nodeport>
kubectl delete -f nginx.yaml
cat << EOF > nginx.yaml
apiVersion: v1
kind: Service
metadata:
name: my-nginx-svc
labels:
app: nginx
spec:
type: NodePort
ports:
- port: 80
selector:
app: nginx
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-nginx
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
volumeMounts:
- name: config-volume
mountPath: /usr/share/nginx/html/index.html
subPath: index.html
volumes:
- name: config-volume
configMap:
# Provide the name of the ConfigMap containing the files you want
# to add to the container
name: nginx-config
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
data:
index.html: |
hello world
EOF
kubectl create -f nginx.yaml
kubectl get svc
curl localhost:<nodeport>
kubectl delete -f nginx.yaml