Skip to content

Instantly share code, notes, and snippets.

heat_template_version: 2014-10-16
description: HOT file for app server
parameters:
#Image
app_server_image_name:
type: string
default: "app_server_image"
#VM name
- hosts: reverse_proxy
remote_user: ubuntu
tasks:
- name: install nginx server
apt:
name: nginx
state: latest
- name: write nginx config file for app 1
template:
src: nginx/webapp
heat_template_version: 2014-10-16
description: ANSIBLE
parameters:
# Image definitions
image:
type: string
default: "bionic-server-cloudimg-amd64"
# Vapp Name
heat_template_version: 2016-04-08
description:
A VM with two volumes
parameters:
stack_name:
type: string
default: test_app
heat_template_version: 2016-04-08
description:
A VM with two volumes
parameters:
stack_name:
type: string
default: test_app
require 'webrick'
require 'webrick/httpproxy'
proxy = WEBrick::HTTPProxyServer.new Port: 8000
trap 'INT' do proxy.shutdown end
trap 'TERM' do proxy.shutdown end
proxy.start

How to build a container image from a local Dockerfile

Open terminal and switch to the folder where the Dockerfile is located.

  docker build . -t number-crunch:1.0.0

Note: Use the -t option to give a name and tag to the image. If not the name and tag fields will be blank when you list your images with docker image ls.

ubuntu@controller:~$ kubectl get pods -o wide
NAME                                READY   STATUS    RESTARTS   AGE   IP            NODE         NOMINATED NODE   READINESS GATES
nginx-deployment-565887c86b-kcp5z   1/1     Running   0          34h   10.1.131.5    microk8s70   <none>           <none>
nginx-deployment-565887c86b-59d25   1/1     Running   0          34h   10.1.73.131   microk8s40   <none>           <none>
ubuntu@controller:~$ kubectl get services
NAME            TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
kubernetes      ClusterIP   10.152.183.1    <none>        443/TCP    2d10h
nginx-service   ClusterIP   10.152.183.23   <none>        8080/TCP   26h
ubuntu@microk8s70:~$ sudo iptables -t nat -L PREROUTING
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination         
cali-PREROUTING  all  --  anywhere             anywhere             /* cali:6gwbT8clXdHdC1b1 */
KUBE-SERVICES  all  --  anywhere             anywhere             /* kubernetes service portals */
ubuntu@microk8s70:~$ sudo iptables -t nat -L KUBE-SERVICES
Chain KUBE-SERVICES (2 references)
target     prot opt source               destination         
KUBE-SVC-WV6VKHDJQKB2TQC4  tcp  --  anywhere             10.152.183.159       /* container-registry/registry:registry cluster IP */ tcp dpt:5000
ubuntu@controller:~/kube-config$ kubectl get services
NAME                    TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
kubernetes              ClusterIP   10.152.183.1    <none>        443/TCP          2d15h
number-crunch-service   NodePort    10.152.183.70   <none>        8080:32155/TCP   10s

ubuntu@controller:~/kube-config$ kubectl get pods -o wide
NAME                                 READY   STATUS    RESTARTS   AGE   IP            NODE         NOMINATED NODE   READINESS GATES
number-crunch-app-7b9d574b47-df4h5   1/1     Running   0          12s   10.1.209.9    microk8s60   <none>           <none>
number-crunch-app-7b9d574b47-xv48x   1/1     Running   0          12s   10.1.131.8    microk8s70   <none>           <none>