by Velucid ⏲ May 18, 2021
OCI OKE(Oracle Kubernetes Engine) 따라하기
OCI OKE 운영을 위한 기본 환경 구성
OCI OKE에 애플리케이션 배포하기
Bastion 서버에 kubectl (K8S 관리용 CLI)을 설치하고, OKE K8S Endpoint와 연동하는 과정을 보여줍니다.
[opc@k8s-manager ~]$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 154 100 154 0 0 435 0 --:--:-- --:--:-- --:--:-- 436
100 44.2M 100 44.2M 0 0 1397k 0 0:00:32 0:00:32 --:--:-- 1431k
xxxxxxxxxx
[opc@k8s-manager ~]$ sudo install -o root -g root -m 0755 kubectl /usr/bin/kubectl
[opc@k8s-manager ~]$ rm kubectl
[opc@k8s-manager ~]$ kubectl version --client
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T16:31:21Z", GoVersion:"go1.16.1", Compiler:"gc", Platform:"linux/amd64"}
xxxxxxxxxx
[opc@k8s-manager ~]$ mkdir -p $HOME/.kube
x[opc@k8s-manager ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export KUBECONFIG=$HOME/.kube/config
xxxxxxxxxx
[opc@k8s-manager ~]$ . .bash_profile
xxxxxxxxxx
[opc@k8s-manager ~]$ env | grep KUBE
KUBECONFIG=/home/opc/.kube/config
xxxxxxxxxx
[opc@k8s-manager ~]$ oci ce cluster create-kubeconfig --cluster-id ocid1.cluster.oc1.ap-seoul-1.aaaa****kxa --file $HOME/.kube/config --region ap-seoul-1 --token-version 2.0.0
New config written to the Kubeconfig file /home/opc/.kube/config
xxxxxxxxxx
opc@k8s-manager ~ $ cat ~/.kube/config
---
apiVersion v1
kind""
clusters
name cluster-cpba6celkxa
cluster
server https //193.***.***..1116443
certificate-authority-data LS0tLS1CRUdJTiBDRVJUSUZ******USUZJQ0FURS0tLS0tCg==
users
name user-cpba6celkxa
user
exec
apiVersion client.authentication.k8s.io/v1beta1
command oci
args
ce
cluster
generate-token
--cluster-id
ocid1.cluster.oc1.ap-seoul-1.aaaa****kxa
--region
ap-seoul-1
env
contexts
name context-cpba6celkxa
context
cluster cluster-cpba6celkxa
user user-cpba6celkxa
current-context context-cpba6celkxa
xxxxxxxxxx
[opc@k8s-manager ~]$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
10.0.10.155 Ready node 3d22h v1.19.7
10.0.10.39 Ready node 3d22h v1.19.7
10.0.10.75 Ready node 3d22h v1.19.7
참고 자료
- OCI Tutorial : OCI kubectl Setting Up
- OCI Doc : OCI CLI Command Reference - OKE
- K8S Doc : Configure Access to Mutiple Clusters