I want to create a single node K8S cluster on AWS and run a simple demo app, exposed to the outside world on port 80. How do I do this?
Conceptually I understand that I need a pod which is defined by a deployment and exposed by an AWS load balancer. I don't understand how k8s has permissions to create an ELB on my behalf?
The waiter container image is here.
Here's where I'm at. All instructions are taken from here:
1) Create the cluster with Ansible (geerlingguy.docker and geerlingguy.kubernetes roles). This role uses kubeadm
.
2) Run the mandatory command:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/mandatory.yaml
3) Run the Layer 4 commands (I arbitrarily picked L4):
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/aws/service-l4.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/aws/patch-configmap-l4.yaml
4) Verify the installation:
$ kubectl get pods --all-namespaces -l app.kubernetes.io/name=ingress-nginx --watch
NAMESPACE NAME READY STATUS RESTARTS
ingress-nginx nginx-ingress-controller-... 1/1 Running 0
5) Create the service:
kubectl apply -f service.yaml
---
apiVersion: v1
kind: Service
metadata:
name: firstappservice
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
selector:
app: firstapp
6) Create the deployment:
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: firstapp
labels:
app: firstapp
spec:
replicas: 1
selector:
matchLabels:
app: firstapp
template:
metadata:
labels:
app: firstapp
spec:
containers:
- name: waiter
image: adamgardnerdt/waiter:v1
ports:
- containerPort: 80
I'm sure I'm missing something simple, yet fundamental. Granted I am a complete Kubernetes noob.