On Premise: Automatic installation via ssh with sudo password

Overview

This page describes how to create cluster via ssh with sudo password or with su command.

Introduction

By default, kublr creates a cluster over an ssh connection with a certificate and without the password from sudo command. But sometimes you need to create a cluster of kubernetes over an ssh connection using a username and password. This article provides knowledge on how to use Kublr to create on-premise kubernetes cluster in the following configuration:

  1. ssh-connection using username and password
    • sudo command with password
    • su command using username and password
  2. ssh-connection using certificate
    • sudo command with password
    • su command using username and password

Create cluster over ssh-connection using username and sudo command with password

Go to Credentials tab and create new credentials with Usrename/Password type

create SSH username and password

Go to the Cluster’s tab and click Add Cluster button Enter the base information and then click the Customize Cluster Specification button and enter additional field master and nodes instance groups sshUserPassSecretRef and username

Fields:

  • sshUserPassSecretRef - is a secret reference that contains username and password credentials for instance group
  • username - is username to connect via SSH, if you do not enter this field, Kublr will use the username from sshUserPassSecretRef secret

Example:

spec:
  locations:
  - name: bare-metal1
    baremetal: {}
  master:
    locations:
    - baremetal:
        hosts:
        - address: 192.168.8.13
        username: ubuntu
        sshUserPassSecretRef: ssh-user-pass
      locationRef: bare-metal1
    minNodes: 1
    name: master
  nodes:
  - locations:
    - baremetal:
        hosts:
        - address: 192.168.8.14
        - address: 192.168.8.15
        - address: 192.168.8.17
        username: ubuntu
        sshUserPassSecretRef: ssh-user-pass
      locationRef: bare-metal1
    minNodes: 3
    name: default

The password for the sudo command will be used the same as in the ssh connection

Create cluster over ssh-connection using username and su command

  • Go to the Credentials tab
    1. create new credential for ssh connection with Usrename/Password type
    2. create new credential for su command with Usrename/Password type
  • Go to the Cluster’s tab and click Add Cluster button
    1. Enter the base information
    2. Click the Customize Cluster Specification button
      1. enter sshUserPassSecretRef additional field for instance groups master and nodes, where value is the name of the credentials for ssh connection
      2. enter suUserPassSecretRef additional field for instance groups master and nodes, where value is the name of the credentials for su command

Fields:

  • sshUserPassSecretRef - is a secret reference that contains username and password credentials for instance group
  • suUserPassSecretRef - is a secret reference containing credentials for a username and password for installation without sudo via su
  • username - is username to connect via SSH, if you do not enter this field, Kublr will use the username from sshUserPassSecretRef secret

Example:

spec:
  locations:
  - name: bare-metal1
    baremetal: {}
  master:
    locations:
    - baremetal:
        hosts:
        - address: 192.168.8.13
        username: ubuntu
        sshUserPassSecretRef: ssh-user-pass
        suUserPassSecretRef: su-user-pass
      locationRef: bare-metal1
    minNodes: 1
    name: master
  nodes:
  - locations:
    - baremetal:
        hosts:
        - address: 192.168.8.14
        - address: 192.168.8.15
        - address: 192.168.8.17
        username: ubuntu
        sshUserPassSecretRef: ssh-user-pass
        suUserPassSecretRef: su-user-pass
      locationRef: bare-metal1
    minNodes: 3
    name: default

Create cluster over ssh-connection using a certificate and sudo command with a password

  • Go to the Credentials tab and create new credentials with Usrename/Password type for sudo command
  • Go to the Cluster tab and click Add Cluster button
    1. Enter the base information through the UI (username and SSH private key)
    2. Click the Customize Cluster Specification button and enter sshUserPassSecretRef additional field for instance groups master and nodes

Fields:

  • sshUserPassSecretRef - is a secret reference that contains username and password credentials for instance group
  • sshKeySecretRef - is a secret reference that contains private SSH key for instance group
  • username - is username to connect via SSH

Example:

spec:
  locations:
  - name: bare-metal1
    baremetal: {}
  master:
    locations:
    - baremetal:
        hosts:
        - address: 192.168.8.13
        username: ubuntu
        sshKeySecretRef: ssh-private-key
        sshUserPassSecretRef: ssh-user-pass
      locationRef: bare-metal1
    minNodes: 1
    name: master
  nodes:
  - locations:
    - baremetal:
        hosts:
        - address: 192.168.8.14
        - address: 192.168.8.15
        - address: 192.168.8.17
        username: ubuntu
        sshKeySecretRef: ssh-private-key
        sshUserPassSecretRef: ssh-user-pass
      locationRef: bare-metal1
    minNodes: 3
    name: default

Create cluster over ssh-connection using a certificate and su command

  • Go to the Credentials tab
    1. create new credential for ssh connection with SSH Private Key type
    2. create new credential for su command with Usrename/Password type
  • Go to the Cluster’s tab and click Add Cluster button
    1. Enter the base information through the UI (username and SSH private key)
    2. Click the Customize Cluster Specification button
      1. enter suUserPassSecretRef additional field for instance groups master and nodes, where value is the name of the credentials for su command

Fields:

  • sshKeySecretRef - is a secret reference that contains private SSH key for instance group
  • suUserPassSecretRef - is a secret reference containing credentials for a username and password for installation without sudo via su
  • username - is username to connect via SSH

Example:

spec:
  locations:
  - name: bare-metal1
    baremetal: {}
  master:
    locations:
    - baremetal:
        hosts:
        - address: 192.168.8.13
        username: ubuntu
        sshKeySecretRef: ssh-private-key
        suUserPassSecretRef: su-user-pass
      locationRef: bare-metal1
    minNodes: 1
    name: master
  nodes:
  - locations:
    - baremetal:
        hosts:
        - address: 192.168.8.14
        - address: 192.168.8.15
        - address: 192.168.8.17
        username: ubuntu
        sshKeySecretRef: ssh-private-key
        suUserPassSecretRef: su-user-pass
      locationRef: bare-metal1
    minNodes: 3
    name: default