# Set up the repository
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
# Install Docker Engine
- Install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:
# 가이드에는 아래 명령어로 되어있음 -> 실행하면 dependency 오류로 설치 안됨 -> 아래 --allowerasing 옵션 주면 podman 등 package remove 하면서 설치됨.
sudo yum install docker-ce docker-ce-cli containerd.io
sudo yum install docker-ce docker-ce-cli containerd.io --allowerasing
# Start Docker.
sudo systemctl start docker
# Verify that Docker Engine is installed correctly by running the hello-world image.
sudo docker run hello-world
# Uninstall Docker Engine
1. Uninstall the Docker Engine, CLI, and Containerd packages:
sudo yum remove docker-ce docker-ce-cli containerd.io
2. Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
- user federation : ldap, AD 등 외부 user database와 연계
# minikube에 설치한 openldap과 연계 방법 정리
# Realm 선택 > 외쪽 메뉴에서 User Federation선택 > 오른쪽에서 ldap 선택
# 설정 내용
- Console Display name : ldap-openldap ( 마음대로 ) - Vendor : Other
- Connection url : ldap://ldap-openldap.ldap.svc:389 ( 동일 클러스터 내에 있어서 service 명으로 접근 )
- User DN : dc=ldap,dc=cloudpak,dc=com ( ldap 에서 지정한 정보 ) - Bind DN : cn=admin,dc=ldap,dc=cloudpak,dc=com ( ldap 로그인 정보 )
- Bind Credential : ldap의 로그인 암호
# ldap에 생성한 user, group 정보
#Synchronize all users 하면 ldap에 생성한 svc1-user1, svc1-user2 가 보임
- user01, user02, user03은 keycloak에 자체 생성한 user임.
# LDAP group 연계 : group연계는 ldap mapper에서 추가해야 함.
- Name : group ( 마음대로 ) - Mapper Type : group-ldap-mapper - LDAP group DN : ou=groups,dc=ldap,dc=cloudpak,dc=com - Group name ldap attribute : cn - Group object classes : groupOfUniqueNames -> ldap에서 group생성할때 지정한 object class - Membership ldap attribute : uniquemember
# ldap에서 생성된 group 연계 확인
- svc1 ( group01은 keycloak에 생성한 group임 )
## 연계한 ldap 정보는 realm 간에 공유되지 않음 ( 생성한 user 정보도 공유 안됨 )
root@minik8s:~# mkdir ldap
root@minik8s:~# cd ldap/
root@minik8s:~/ldap# ls
root@minik8s:~/ldap# kubectl create namespace ldap
namespace/ldap created
root@minik8s:~/ldap#
# helm repo 연결 및 config.yaml 생성
root@minik8s:~/ldap# helm repo add stable https://kubernetes-charts.storage.googleapis.com
"stable" has been added to your repositories
root@minik8s:~/ldap# helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "codecentric" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈ Happy Helming!⎈
root@minik8s:~/ldap# helm inspect values stable/openldap > config.yaml
root@minik8s:~/ldap# helm repo add cetic https://cetic.github.io/helm-charts
"cetic" has been added to your repositories
root@minik8s:~/ldap# helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "cetic" chart repository
...Successfully got an update from the "codecentric" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈ Happy Helming!⎈
root@minik8s:~/ldap# helm inspect values cetic/phpldapadmin > phpldapadmin.yaml
# phpldapadmin.yaml 수정
- LDAP_HOST : 앞에 설치한 openldap의 service 명( 동일 namespace 경우 )
Keycloak is an open source Identity and Access Management solution aimed at modern applications and services. It makes it easy to secure applications and services with little to no code.
root@minik8s:~# kubectl create ns keycloak
namespace/keycloak created
root@minik8s:~# helm repo add codecentric https://codecentric.github.io/helm-charts
"codecentric" has been added to your repositories
# keycloak config 설정을 위해 values.yaml 생성
root@minik8s:~# mkdir keycloak && cd keycloak
root@minik8s:~/keycloak# helm show values codecentric/keycloak > values.yaml
# values.yaml 내용 수정
- keycloak 계정 암호 지정
- ingress, route 생성시 true로 변경 ( 이 문서에서는 false로 설치 함 )
- DB 지정
- PVC 지정
- 생성된 PVC
# 설치 후 확인
root@minik8s:~/keycloak# kubectl get all -n keycloak
NAME READY STATUS RESTARTS AGE
pod/keycloak-0 1/1 Running 0 2m13s
pod/keycloak-postgresql-0 1/1 Running 0 2m13s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/keycloak-headless ClusterIP None <none> 80/TCP,8443/TCP 2m15s
service/keycloak-http ClusterIP 10.104.146.230 <none> 80/TCP,8443/TCP 2m14s
service/keycloak-postgresql ClusterIP 10.106.34.115 <none> 5432/TCP 2m14s
service/keycloak-postgresql-headless ClusterIP None <none> 5432/TCP 2m15s
NAME READY AGE
statefulset.apps/keycloak 1/1 2m14s
statefulset.apps/keycloak-postgresql 1/1 2m14s
- values.yaml에서 ingress를 true로 하지 않아서 외부 접근 안됨 -> ClusterIP를 NodePort로 변경해서 접근 가능함
# clusterIP를 NodePort 로 변경후 확인
root@minik8s:~/keycloak# kubectl edit svc keycloak-http -n keycloak
service/keycloak-http edited
root@minik8s:~/keycloak# kubectl get all -n keycloak
NAME READY STATUS RESTARTS AGE
pod/keycloak-0 1/1 Running 0 5m15s
pod/keycloak-postgresql-0 1/1 Running 0 5m15s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/keycloak-headless ClusterIP None <none> 80/TCP,8443/TCP 5m17s
service/keycloak-http NodePort 10.104.146.230 <none> 80:30478/TCP,8443:32572/TCP 5m16s
service/keycloak-postgresql ClusterIP 10.106.34.115 <none> 5432/TCP 5m16s
service/keycloak-postgresql-headless ClusterIP None <none> 5432/TCP 5m17s
NAME READY AGE
statefulset.apps/keycloak 1/1 5m16s
statefulset.apps/keycloak-postgresql 1/1 5m16s
# URL접근( http://<VM IP>:<NodePort>
# administration console 눌러서 login 화면 이동 -> values.yaml에서 지정한 계정/암호(keycloak / password)로 로그인
# Master Realm 은 default로 생성됨
- realm을 생성하고, clients(연계 대상 : jenkins 등)을 생성해서 연계함
http://tekton-dashboard.<VM_IP>.nip.io 로 dashboard 접근 가능
# tekton cli 설치
# Get the tar.xz
curl -LO https://github.com/tektoncd/cli/releases/download/v0.8.0/tkn_0.8.0_Linux_x86_64.tar.gz
# Extract tkn to your PATH (e.g. /usr/local/bin)
sudo tar xvzf tkn_0.8.0_Linux_x86_64.tar.gz -C /usr/local/bin/ tkn
select count(*) from hive.metering.datasource_openshift_metering_pod_request_cpu_cores where dt='2020-03-23' and labels['namespace']='openshift-metering';
select * from datasource_openshift_metering_pod_memory_request_raw where namespace='openshift-metering' and dt='2020-03-23';
# 로그인
$ mongo admin -u root -p {password}
MongoDB shell version v4.0.12
# db 조회
> show dbs
admin 0.000GB
config 0.000GB
db-users 0.000GB
local 0.000GB
# db 선택
> use db-users
switched to db db-users
# collection(table) 조회
> show collections
or > show tables
users --> 조회된 collection(table)
# 내용 조회(현재DB.collection)
> db.users.find()
# JSON 형태 보기
> db.user.find().pretty()