Skip to content

Instantly share code, notes, and snippets.

@francop-eb
Forked from aravindmyaka-eb/K8s-demo.md
Created August 25, 2018 08:37
Show Gist options
  • Save francop-eb/476679b890b0f94decae21a1c5fffac6 to your computer and use it in GitHub Desktop.
Save francop-eb/476679b890b0f94decae21a1c5fffac6 to your computer and use it in GitHub Desktop.
  1. list namespaces

    kubectl get namespace
    
  2. switch to demo namespace

    kubectl config set-context devenv --namespace=demo
    
  3. list pods

    kubectl get pods
    
  4. list deployment configuration files (yaml)

    cd ~/eventbrite/docker-dev/kubernetes/ && ls -l | grep yaml
    
  5. deploy containers (bay up equivalent)

    kubectl apply -f .
    

    Note: Each container is being started in a seperate pod. These are being run in certified K8s cloud infra - Amazon EKS

  6. list pods and their statuses

    kubectl get pods
    

    Note: These commands are kubectl tool's low-level commands. A lighter tool on top of kubectl will be provided that has similar or better abstraction level than bay.

  7. shell into a container (bay shell equivalent)

    kubectl exec -ti core-web-76745bc545-brxtf bash
    
  8. tail logs (bay tail ... equivalent)

    kubectl logs -f core-web-76745bc545-brxtf
    
  9. setup dashboard for monitoring

    kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
    
    kubectl proxy
    

    Note: To switch to dashboard of a diff namespace, edit namespace value in url http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#!/overview?namespace=demo

  10. open dashboard

  11. forward remote port to your local

    kubectl port-forward deployment/core-web 4443:443
    
  12. proxy local traffic from 443 to 4443

    sudo socat tcp-l:443,fork,reuseaddr tcp:127.0.0.1:4443
    
  13. Open https://www.evbdev.com in browser


  1. rsync (bay mount equivalent)
    oc rsync -w --exclude=js,django/media/django,.git ~/eventbrite/core core-web-76745bc545-brxtf:/srv/core
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment