Skip to content

Instantly share code, notes, and snippets.

@pedrodelgallego
Last active August 10, 2017 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedrodelgallego/b185ac96d78be2202ce3ff14dc8deb96 to your computer and use it in GitHub Desktop.
Save pedrodelgallego/b185ac96d78be2202ce3ff14dc8deb96 to your computer and use it in GitHub Desktop.

Pre:

  • Create a s3 repo to contain the cluster state.
  • Create a Route53 domain and hosted zone.

Create a cluster definition

kops create cluster --name=demo.simplepipeline.xyz\
     --node-size=t2.micro\
     --state=s3://k8s-demo-simplepipeline.xyz\
     --zones=eu-west-1a\
     --node-count=2\
     --master-size=t2.micro\
     --dns-zone=demo.simplepipeline.xyz

List the new cluster

kops get cluster\
  --state=s3://k8s-demo-simplepipeline.xyz

Update the cluster

kops update cluster simplepipeline.xyz --yes\
  --state=s3://k8s-demo-simplepipeline.xyz

Validate the cluster

 kops validate cluster\
  --state=s3://k8s-demo-simplepipeline.xyz

Get cluster credentials.

cat ~/.kube/config

Run demo program to check it is working

kubectl run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080
kubectl expose deployment hello-minikube --type=NodePort

Accessing the service

$ kubectl get service
NAME             CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
hello-minikube   100.67.26.21   <nodes>       8080:31435/TCP   27s
kubernetes       100.64.0.1     <none>        443/TCP          44m

In the VPC security group tab in AWS modify the master.simplepipeline.xyz allowing incoming traffic from the new port.

curl api.simplepipeline.xyz:31435/test

Install Dashboard

kubectl create -f https://raw.githubusercontent.com/kubernetes/kops/master/addons/kubernetes-dashboard/v1.6.3.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment