Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: update docs

Connect to the Server

  1.  Connect to EC2:
    Run the following command, where
    1. Code Block
      ssh -i  <private.key> -L 6445:localhost:6443 username@ssh.diaper-project.com
      1. -L mean to forward server's port to local
  1. . Because
      1. , because Kubernetes exposes port 6445, we would like to forward it to localhost:6443.
  2. The username should just be your Cornell NetID (it's easier to memorize)
      1.  Username is your NetID. An admin account holder should be able to create the linux account for you.

  3. ssh -i  <private.key> -L 6445:localhost:6443 username@ssh.diaper-project.com 
    1. If permission error

      Code Block
      sudo chmod 600 private.key
    2. You should see a pop-up looks like this, which means that you have already connected to the server.
  4.  
    1. Image Modified

Connect to Kubernetes

  1. We first need to install Kubernetes on our local machine. To install using Install Kubernetes by Docker (you might want to use Docker to build images), check out Install and turn on Kubernetes.
  2. There are various UI explorers for Kubernetes, one of my favorites is called k9s. To install. Such as k9s, check out out Install (k9scli.io).
  3. Add the server cluster credentials in the Kubernetes config file. (In Mac, config file is located in ~/.kube). The configuration is as follows:
    1. Code Block
      languageyml
    titleKubernetes Config Filelinenumberscollapsetrue
    true
    1. apiVersion: v1
      clusters:
      - cluster:
          certificate-authority-data: 
    LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJlRENDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTrEPCPrqR3YziyHVBJnibzUcQvxyeVaz756SXpNRFl3SGhjTk1qUXdNakExTTrEPCPrqR3YziyHVBJnibzUcQvxyeVaz7RRMgpXakFqTTrEPCPrqR3YziyHVBJnibzUcQvxyeVaz71WeUxXTmhRREUzTTrEPCPrqR3YziyHVBJnibzUcQvxyeVaz7BRSUJCZ2dxaGtqT1BRTTrEPCPrqR3YziyHVBJnibzUcQvxyeVaz7NqNkNIdDlxK3daSUV6N093ajM5VXJmRnoKTTrEPCPrqR3YziyHVBJnibzUcQvxyeVaz7dTTrEPCPrqR3Yzi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RJRklDQVRFLS0tLS0K
        
    1.   server: https://127.0.0.1:6445
        name: diaper-server
      contexts:
      - context:
          cluster: diaper-server
          user: <Kubernetes service account name>
        name: diaper-server
      current-context: diaper-server
      kind: Config
      preferences: {}
      users:
      - name: <Kubernetes service account name>
        user:
          token: <Kubernetes service account token>
  4. After adding the configs, you should be able to connect Connect to the Kubernetes cluster using k9s. If your k9s is under one of the environments $PATH, you can simply run: k9s on any command line interface. It looks like the following:the command
    1. Code Block
      k9s
  5. then you have
    1. Image Modified

If you don't see all pods running, it is probably because you're viewing a specific namespace. You can simply press '0' to view pods in all namespaces.

  1. To navigate between Services, Deployments, or Pods, you can type 
    :services       or       :deployments       or       :pods
  2. To port-forward a pod, type shift+F.  To view the log, type l. To kill a pod, type ctrl+k.... You can always view these commands by typing ?(question mark).

...