Creating a PKS Kubernetes Cluster

Prerequisites

You are responsible for creating the PKS cluster, and to ensure that the k8s client kubectl is configured properly to communicate with the PKS k8s cluster. For example, use kubectl get nodes to check the output of all the nodes participating in PKS cluster.
Note:
Note: If you have modified the k8s_deploy_namespace to a specific namespace in k8s cluster, you need to configure kubectl again for the given namespace. After running the above command, the kube config file (~/.kube/config) will have an entry for the PKS k8s cluster and user as below.
apiVersion: v1

clusters:

- cluster:

    certificate-authority-data: abc

    server: <k8s master url>

  name: ml52pks1

contexts:

- context:

    cluster: ml52-system

    user: 3d128617-ba6c-4764-886a-27db12dde826

  name: ml52-system

current-context: ml52-system

kind: Config

preferences: {}

users:

- name: ml52pks1

  user:

    client-certificate-data: xyz
Note down the value of cluster and user.

Creating a new context for namespace in kubectl

Execute below commands to create a new context for the namespace you want to deploy and configure kubectl for the new context.

Procedure

  1. kubectl config set-context <conext-name> --namespace=<namespace_value provided in the manifest-single-zone.json> --cluster=<k8s cluster name > --user=<k8s user>.
    Sample command:
    kubectl config set-context ml51dev --namespace ml51-system --cluster=ml51pks1 --user=3d128617-ba6c-4764-886a-27db12dde826
  2. kubectl config use-context <context-name>
    Sample command:
    kubectl config use-context ml51dev

Log into the Docker registry

Use the following details to log into the Docker registry:
  • docker login <Docker Registry>
  • u <Admin UserName>
  • p <Password>
Note: For harbor registry, the password remains the same as the admin credentials provided at the time of harbor configuration.
After successful login, check the ~/.docker/config.json file for the login credentials under auth.
cat ~/.docker/config.json
{
    "auths": {
        "<docker-registry>": {
            "auth": "XXXXXXX"
        }
    },
    "HttpHeaders": {
        "User-Agent": "Docker-Client/17.12.0-ce (darwin)"
    }