Create SSH key using ssh-keygen
on linux terminal to access (ssh) the Compute
instances (worker/bastion) in OCI.
ssh-keygen -t rsa -N "" -b 2048 -C demokey -f id_rsa
Within your tenancy, there must be a compartment to contain the necessary network resources (VCN, subnets, internet gateway, route table, security lists).
Create Compartment
button.Create Compartment
button.Developer Services
and click Kubernetes Clusters (OKE)
.
Create Cluster
to create the new network resources and the new cluster.
Node Pools
on Resources and then View
to view the Node Pool and worker node status
Kubernetes Node Condition
is Ready.
Access Cluster
on the Cluster WCCOKEPHASE1
page.
Setup a bastion node for accessing internal resources.
We will create the bastion node in same VCN following below steps, so that we can ssh into worker nodes.
Here we will choose CIDR Block: 10.0.22.0/24
. You can choose a different block, if you want.
Click on the VCN Name from the Cluster Page as shown below
Next Click on Security List
and then Create Security List
Create a bastion-private-sec-list
security with below Ingress and Egress Rules.
Ingress Rules:
Egress Rules:
Create a bastion-public-sec-list
security with below Ingress and Egress Rules.
Ingress Rules:
Egress Rules:
Create the bastion-route-table
with Internet Gateway
, so that we can add to bastion instance for internet access
Next create a Regional Public Subnet for bastion instance with name bastion-subnet
with below details:
Next Click on the Private Subnet which has Worker Nodes
And then add the bastion-private-sec-list
to Worker Private Subnet, so that bastion instance can access the Worker nodes
Next Create Compute Instance oke-bastion
with below details
Once bastion Instance BastionHost
is created, get the Public IP to ssh into the bastion instance
Login to bastion host as below
ssh -i <your_ssh_bastion.key> opc@123.456.xxx.xxx
bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
$ oci setup config
User Settings
, which is in the drop down under your OCI userprofile, located at the top-right corner of the page.
Api Keys
link, located near bottom-left corner of the page and then Click the Add API Key
button. Copy the content of oci_api_key_public.pem
and Click Add
.
Access Cluster
on the Cluster WCCOKEPHASE1
page
Local Access
.
$ oci -v
$ mkdir -p $HOME/.kube
$ oci ce cluster create-kubeconfig --cluster-id ocid1.cluster.oc1.phx.aaaaaaaaae4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxrqgjtd
--file $HOME/.kube/config --region us-phoenix-1 --token-version 2.0.0
$ export KUBECONFIG=$HOME/.kube/config
$ curl -LO https://dl.k8s.io/release/v1.15.7/bin/linux/amd64/kubectl
$ sudo mv kubectl /bin/
$ sudo chmod +x /bin/kubectl
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
10.0.10.197 Ready node 14d v1.18.10
10.0.10.206 Ready node 14d v1.18.10
10.0.10.50 Ready node 14d v1.18.10
$ wget https://get.helm.sh/helm-v3.1.1-linux-amd64.tar.gz
$ tar -zxvf helm-v3.1.1-linux-amd64.tar.gz
$ sudo mv linux-amd64/helm /bin/helm
$ helm version
version.BuildInfo{Version:"v3.1.1", GitCommit:"afe70585407b420d0097d07b21c47dc511525ac8", GitTreeState:"clean", GoVersion:"go1.13.8"}
sudo yum install git -y