Exemple #1
0
def print_help_external_etcd(hi):
    """ help for external etcd installation """

    utils.print_H1('How to install an external Etcd')
    utils.print_normal(
        'By default external etcd will be automatically installed by `kubeadm-playground create` ',
        "in case your cluster has machines with role '%s'." %
        (cluster_api.ROLE_ETCD))
    if len(hi.etcds) == 0:
        print
        utils.print_warning(
            'The kubeadm playground currently does not require an external etcd.',
            'Please change your cluster api specification')

    utils.print_H2('Assisted mode')
    utils.print_normal(
        "* only if automatic installation was disabled during create")
    utils.print_code("kubeadm-playground exec external-etcd")

    utils.print_H2('Manual mode')
    utils.print_normal('- Install etcd on following machines:')
    for m in hi.etcds:
        utils.print_normal("   - %s" % (m.name))
    print
    utils.print_normal(
        "- Ensure that etcd endpoint and eventually etcd TLS certificates are set in '/etc/kubernetes/kubeadm.conf' on %s"
        % (hi.bootstrapMaster.name))
    print
Exemple #2
0
def print_help_kubeadm_init(hi):
    utils.print_H1 ('How to execute kubeadm init')
    
    utils.print_H2 ('Assisted mode')
    utils.print_code ("kubeadm-playground exec kubeadm-init")

    utils.print_H2 ('Manual mode')
    ssh_to (hi.bootstrapMaster.name)
    utils.print_normal ('- Initialize the kubernetes master node')
    utils.print_code ("sudo %s init --config /etc/kubernetes/kubeadm.conf" % (hi.kubeadm_binary))
Exemple #3
0
def print_help_kubectl_apply_network(hi):
    utils.print_H1 ("How to install %s network addon" % (hi.networkAddon))
    
    utils.print_H2 ('Assisted mode')
    utils.print_code ("kubeadm-playground exec kubectl-apply-network")

    utils.print_H2 ('Manual mode')
    ssh_to (hi.bootstrapMaster.name)

    if hi.kubernetes_cni_sysconf:
        utils.print_normal ("- Make required changes for %s CNI plugin to work:" % (hi.networkAddon))  
        utils.print_code ('sudo sysctl net.bridge.bridge-nf-call-iptables=1')
    utils.print_normal ("- Install %s CNI plugin:" % (hi.networkAddon))
    utils.print_code ('kubectl apply \\',
            "     -f %s" % (hi.kubernetes_cni_manifest_url))
Exemple #4
0
def print_help_external_ca(hi):
    """ help for external ca installation """

    utils.print_H1('How to setup an external Certificate Authority')
    utils.print_normal(
        'By default external CA will be automatically installed by `kubeadm-playground create` ',
        'in case your cluster is configured with `certificateAuthority: external`'
    )
    if hi.cluster.certificateAuthority != kubeadm_utils.CERTIFICATEAUTHORITY_TYPE_EXTERNAL:
        print
        utils.print_warning(
            'The kubeadm playground currently does not require an external ca.',
            'Please change your cluster api specification')

    utils.print_H2('Assisted mode')
    utils.print_normal(
        "* only if automatic installation was disabled during create")
    utils.print_code("kubeadm-playground exec external-ca")

    utils.print_H2('Manual mode')
    ssh_to(hi.bootstrapMaster.name)
    utils.print_normal('- Create an external CA by executing:')
    utils.print_code(
        "sudo %s alpha phase certs all --config /etc/kubernetes/kubeadm.conf" %
        (hi.kubeadm_binary), 'sudo rm /etcd/kubernetes/pki/ca.key',
        'sudo rm /etcd/kubernetes/pki/front-proxy-ca.key')
    print
Exemple #5
0
def print_help_kubeadm_join(hi):
    utils.print_H1("How to execute kubeadm join")
    if len(hi.nodes) == 0:
        print
        utils.print_warning(
            'The kubeadm playground currently does not have worker nodes.',
            'Please change your cluster api specification')

    utils.print_H2('Assisted mode')
    utils.print_code("kubeadm-playground exec kubeadm-join")

    utils.print_H2('Manual mode')
    utils.print_normal(
        "Repeat following steps for all the machines with role '%s'" %
        (cluster_api.ROLE_NODE))
    if hi.kubernetes_cni_sysconf:
        utils.print_normal(
            "- Make required changes for %s CNI plugin to work:" %
            (hi.networkAddon))
        utils.print_code('sudo sysctl net.bridge.bridge-nf-call-iptables=1')
    utils.print_normal('- Join the worker node')
    utils.print_code(
        "sudo %s join %s:6443 --token %s \\" %
        (hi.kubeadm_binary, hi.controlplaneEndpoint, hi.kubeadm_token),
        "         --discovery-token-unsafe-skip-ca-verification")
Exemple #6
0
def __usage(prompt=None, extra_usage=None):
    if prompt:
        utils.print_err(prompt)
    if extra_usage:
        utils.print_normal(extra_usage)
    exit(0)
Exemple #7
0
def ssh_to(machine):
    utils.print_normal('From the guest machine:')
    utils.print_code("kubeadm-playground ssh %s" % (machine))
    utils.print_normal('After connecting:')
    print
Exemple #8
0
def print_help_external_vip(hi):
    """ help for external vip installation """

    utils.print_H1('How to setup an external Vip/load balancer')
    if len(hi.etcds) == 0:
        print
        utils.print_warning(
            'The kubeadm playground currently does not require an external vip.',
            'Please change your cluster api specification')

    utils.print_normal(
        'By default external etcd will be automatically installed by `kubeadm-playground create` ',
        "in case your cluster has more then one machines with role '%s'." %
        (cluster_api.ROLE_MASTER))

    utils.print_H2('Assisted mode')
    utils.print_normal(
        "* only if automatic installation was disabled during create")

    utils.print_H2('Assisted mode')
    utils.print_normal(
        'By default external vip/load balancer will be automatically installed by `kubeadm-playground create` ',
        'in case your cluster is configured with more than one machine with role `Master`',
        ''
        "The vip address will be %s (%s) and will balance following api server end points:"
        % (hi.kubernetes_vip_fqdn, hi.kubernetes_vip_ip))
    for m in hi.masters:
        utils.print_normal("- https://%s:6443" % (m.ip))

    print
    utils.print_normal(
        'If automatic installation of external vip was disabled during create, it can be invoked afterwards with:'
    )

    utils.print_code("kubeadm-playground exec external-vip")

    utils.print_H2('Manual mode')
    utils.print_normal(
        '- Create an external VIP/load balancer similar to what described above.'
    )
    utils.print_normal(
        "- Ensure that the VIP address is set in '/etc/kubernetes/kubeadm.conf' on %s."
        % (hi.bootstrapMaster.name))
    print