Skip to content

An ssh-bastion pod to make access to openshift clusters easy

License

Notifications You must be signed in to change notification settings

mtnbikenc/ssh-bastion

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ssh-bastion

An ssh-bastion pod to make access to openshift clusters easy

  1. Make sure that oc is configured to talk to the cluster

  2. Optionally configure the namespace where the bastion will run:

    export SSH_BASTION_NAMESPACE=openshift-ssh-bastion
    

    By default openshift-ssh-bastion is used.

  3. Run:

    curl https://raw.githubusercontent.com/eparis/ssh-bastion/master/deploy/deploy.sh | bash
    

    This will create a new pod running an sshd server. The sshd server is exposed via a k8s service backed by a loadbalancer(based on your cloud platform). The service hostname will provide access to the sshd server. (See below for how to get the hostname)

    The sshd server is configured to allow login as user core using the same private key that was used to create the cluster.

  4. SSH as the core user to/through the bastion.

    • Use the -A option (ForwardAgent) for your key to be automatically forwarded to the nodes from the bastion pod.
    • You can use a helper script to ssh directly to a node by the node's name (from oc get node). This script uses ssh authentication forwarding so you can directly hop from the bastion to the cluster nodes.

    If you need to use a non-default SSH key, you can:

    • Export the SSH_KEY_PATH environment variable to change its location. For example:
      export SSH_KEY_PATH=~/.ssh/my_kustom_cey.pem
      
    • Run something like ssh-agent and add your key to that utility
    • Directly add or update the SSH keys in your OCP deployment see Update SSH Keys.
  5. The bastion address can be found by running:

    oc get service -n openshift-ssh-bastion ssh-bastion -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
    

About

An ssh-bastion pod to make access to openshift clusters easy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 94.1%
  • Dockerfile 4.1%
  • Makefile 1.8%