Skip to content

Instantly share code, notes, and snippets.

@rainbyte
Last active September 20, 2017 17:55
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 rainbyte/c8b6018825af532c7dda526c7d9248da to your computer and use it in GitHub Desktop.
Save rainbyte/c8b6018825af532c7dda526c7d9248da to your computer and use it in GitHub Desktop.
bluemix kubernets tutorial

Procedimiento para usar contenedores en Bluemix via Kubernetes

  1. Instalar Bluemix console tool y Kubernetes kubectl.
  2. Preparar los plug-ins que vamos a necesitar para usar contenedores:
    bx plugin install container-registry -r Bluemix
    bx plugin install container-service -r Bluemix
    
  3. Iniciar sesión en Bluemix con nuestras credenciales:
    bx login -a https://api.ng.bluemix.net
    
  4. Iniciamos sesión en Bluemix Container Registry (CR):
    bx cr login
    
  5. Agregamos un espacio de nombres a nuestra cuenta de CR:
    bx cr namespace-add <namespace>
    
  6. Inicializar plug-in Bluemix Container Services (CS) y obtener tokens:
    bx cs init
    
  7. Habilitar certificados para poder manipular el cluster con kubectl:
    bx cs cluster-config <cluster_name>
    export KUBECONFIG=<kubeconfig_path>
    
  8. Generar imagen de docker y subirla a Bluemix CR:
    docker build -t <image_name>:<image_tag> -f <dockerfile_path> .
    docker tag <image_name>:<image_tag> registry.ng.bluemix.net/<namespace>/<image_name>:<image_tag>
    docker push registry.ng.bluemix.net/<namespace>/<image_name>:<image_tag>
    
  9. Cargar imagen de docker en el cluster y hacerla accesible:
    kubectl run <deployment_name> --image=registry.ng.bluemix.net/<namespace>/<image_name>:<image_tag> --port=<port>
    kubectl expose deployment/<deployment_name> --type=NodePort --port=<port> --name=<service_name> --target-port=<port>
    

Diagnostico en Bluemix y Kubernetes:

  • Obtener ip publica y privada brindadas por Bluemix para el cluster:     bx cs workers <cluster_name>    
  • Obtener info sobre el servicio, incluido el port necesario para acceder:     kubectl get svc/<service_name>    
  • Observar items disponibles desde kubectl:
    kubectl get all # tambien se puede get svc, get deploy, etc
    
  • Utilizar interfaz web de Kubernetes:
    kubectl proxy # habilitar web ui
    firefox 'localhost:8001/ui'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment