- JDK
2. Tomcat
3. Maven 다운로드
3. Eclipse 다운로드
4. JDK설치후 Installed JRE 지정
5. Tomcat 추가
6. maven 셋팅
7. Import project
8. spring plugin 설치
9. lib 두개 추가
https://s3.ap-northeast-2.amazonaws.com/cf-templates-3gnxnw1y9tyu-ap-northeast-2/faro_sql.tar
Designing Microservices using Spring Boot, Spring Cloud, Eureka and Zuul
https://www.youtube.com/watch?v=rlS9eH5tEnY
'dev > etc' 카테고리의 다른 글
atom (0) | 2018.07.27 |
---|---|
vmware hyper-v 충돌 (0) | 2017.05.10 |
타이핑 교정 (0) | 2017.04.25 |
Kuber
3개 노드면
1개는 master,
2개는 worker (컨테이너)
RC (리플리케이션 컨트롤러) 잘 안씀
Deployment 씀
Service : 포드간에 네트웍을 처리하는 개체
짝짓기 : label, selector
GCP에서 구성할때는 디폴트로 제공되는것 들이 많다 (ex: cAdvisor)
==Docker v 1.12 설치=================================
apt-get update
apt-get install apt-transport-https ca-certificates
apt-key adv \
--keyserver hkp://ha.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y linux-image-extra-$(uname -r) linux-image-extra-virtual
apt-get install -y docker-engine=1.12.0-0~xenial
==Kubernetes 설치==========================================
==모든 노드에서
apt-get update
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubelet kubeadm kubernetes-cni
[설치]
도커 1.12버전이 쿠버와 안정적
==마스터에서
kubeadm init
mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
export kubever=$(kubectl version | base64 | tr -d '\n')
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$kubever"
kubectl get pods --all-namespaces 명령 결과 모든 요소의 설치가 완료될때까지 기다린다.
==노드에서
마스터의 kube init 결과로 나온 토큰 조인 구문을 실행한다.
ex)
kubeadm join --token 90deae.6aac5fc055c311ed 10.10.12.141:6443 --discovery-token-ca-cert-hash sha256:e6c3fec15d9d707eeb76ee466cf1f3713563399b96d8853aab720157630fd5cc
==문제 발생시
kubeadm reset
/etc/systemd/system/kubelet.service.d/10-kubeadm.conf 파일에 다음을 추가
Environment="KUBELET_EXTRA_ARGS=--fail-swap-on=false"
systemctl daemon-reload
systemctl restart kubelet
Desired Status :1 이면
- pod나 docker container를 아무리 지워도 1로 유지됨
---------------------------------------------------------------------------------------------------------------------------------------
root@host14-01:~# scp 10.10.12.171:/test/* /test/
root@10.10.12.171's password:
busybox-ns.yaml 100% 371 0.4KB/s 00:00
curlpod.yml
.....
---------------------------------------------------------------------------------------------------------------------------------------
root@host14-01:~# kubectl create -f /test/simple-pod.yml
pod "simple" created
root@host14-01:~# kubectl get no
NAME STATUS ROLES AGE VERSION
host14-01.cloud.com Ready master 14h v1.8.1
host14-02.cloud.com Ready <none> 14h v1.8.1
host14-03.cloud.com Ready <none> 14h v1.8.1
root@host14-01:~# kubectl get po
NAME READY STATUS RESTARTS AGE
simple 0/1 ContainerCreating 0 43s
---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
root@host14-01:~# kubectl describe po simple
Name: simple
Namespace: default
Node: host14-02.cloud.com/10.10.12.142
Start Time: Fri, 20 Oct 2017 11:43:58 +0900
Labels: <none>
Annotations: <none>
Status: Running
IP: 10.44.0.1
Containers:
web:
Container ID: docker://a089ef160476ae3b1d492bed6724ea0ffd50f229bbef241fcc203dd0ed27a03a
Image: nginx
Image ID: docker-pullable://nginx@sha256:004ac1d5e791e705f12a17c80d7bb1e8f7f01aa7dca7deee6e65a03465392072
Ports: 80/TCP, 443/TCP
State: Running
Started: Fri, 20 Oct 2017 11:49:05 +0900
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-k7qw2 (ro)
Conditions:
Type Status
Initialized True
Ready True
PodScheduled True
Volumes:
default-token-k7qw2:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-k7qw2
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.alpha.kubernetes.io/notReady:NoExecute for 300s
node.alpha.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 5m default-scheduler Successfully assigned simple to host14-02.cloud.com
Normal SuccessfulMountVolume 5m kubelet, host14-02.cloud.com MountVolume.SetUp succeeded for volume "default-token-k7qw2"
Normal Pulling 5m kubelet, host14-02.cloud.com pulling image "nginx"
Normal Pulled 22s kubelet, host14-02.cloud.com Successfully pulled image "nginx"
Normal Created 22s kubelet, host14-02.cloud.com Created container
Normal Started 21s kubelet, host14-02.cloud.com Started container
root@host14-01:~# kubectl get po -o wide
NAME READY STATUS RESTARTS AGE IP NODE
simple 1/1 Running 0 5m 10.44.0.1 host14-02.cloud.com
---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
포트내 컨테이너 통신은 port로 가능
---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
root@host14-01:/test# kubectl create -f multi.yml
pod "multi" created
root@host14-01:/test# kubectl get po
NAME READY STATUS RESTARTS AGE
multi 0/2 ContainerCreating 0 23s
simple 1/1 Running 0 12m
---------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------
root@host14-01:/test# kubectl create -f nodejs-controller.yaml
replicationcontroller "node-js" created
root@host14-01:/test#
root@host14-01:/test# kubectl get rc
NAME DESIRED CURRENT READY AGE
node-js 3 3 0 14s
=> 3은 pod 개수
root@host14-01:/test# kubectl get pod
NAME READY STATUS RESTARTS AGE
multi 0/2 ErrImagePull 0 9m
node-js-695kl 0/1 ContainerCreating 0 30s
node-js-rdrkk 0/1 ContainerCreating 0 30s
node-js-shq4v 0/1 ContainerCreating 0 30s
simple 1/1 Running 0 21m
root@host14-01:/test# kubectl get pod
NAME READY STATUS RESTARTS AGE
multi 0/2 ErrImagePull 0 15m
node-js-695kl 0/1 ContainerCreating 0 6m
node-js-rdrkk 0/1 ContainerCreating 0 6m
node-js-shq4v 0/1 ContainerCreating 0 6m
simple 1/1 Running 0 27m
root@host14-01:/test# kubectl create -f nodejs-rc-service.yaml
service "node-js" created
root@host14-01:/test# kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 14h
node-js LoadBalancer 10.103.138.190 <pending> 80:31057/TCP 14s <== internal ip
root@host14-01:/test# kubectl delete svc node-js
root@host14-01:/test# cat mysql-password.yml
apiVersion: v1
kind: Secret
metadata:
name: mysql-passwords
type: Opaque
data:
root: cm9vdC1wYXNzd29yZA==
wordpress: d29yZHByZXNzLXBhc3N3b3Jk
-----------------------------------------------------
root@host14-01:/test# kubectl create -f multi-secret.yml
pod "multi-secrets" created
root@host14-01:/test# kubectl get po
NAME READY STATUS RESTARTS AGE
multi 2/2 Running 0 2h
multi-secrets 0/2 ContainerCreating 0 13s
node-js-695kl 1/1 Running 0 2h
node-js-rdrkk 1/1 Running 0 2h
node-js-shq4v 1/1 Running 0 2h
simple 1/1 Running 0 2h
root@host14-01:/test# kubectl get po
NAME READY STATUS RESTARTS AGE
multi 2/2 Running 0 2h
multi-secrets 2/2 Running 0 24s
node-js-695kl 1/1 Running 0 2h
node-js-rdrkk 1/1 Running 0 2h
node-js-shq4v 1/1 Running 0 2h
simple 1/1 Running 0 2h
root@host14-01:/test# kubectl exec multi-secrets -c db -it bash
root@multi-secrets:/# hostname
multi-secrets
root@multi-secrets:/# env
NODE_JS_PORT_80_TCP=tcp://10.96.94.67:80
HOSTNAME=multi-secrets
NODE_JS_PORT=tcp://10.96.94.67:80
KUBERNETES_PORT=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP_PORT=443
MYSQL_VERSION=5.7.20-1debian8
NODE_JS_PORT_80_TCP_PROTO=tcp
KUBERNETES_SERVICE_PORT=443
MYSQL_DATABASE=wordpress
KUBERNETES_SERVICE_HOST=10.96.0.1
MYSQL_PASSWORD=wordpress-password
NODE_JS_PORT_80_TCP_PORT=80
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
SHLVL=1
HOME=/root
KUBERNETES_PORT_443_TCP_PROTO=tcp
MYSQL_MAJOR=5.7
KUBERNETES_SERVICE_PORT_HTTPS=443
GOSU_VERSION=1.7
NODE_JS_SERVICE_HOST=10.96.94.67
MYSQL_USER=wordpress
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
NODE_JS_PORT_80_TCP_ADDR=10.96.94.67
MYSQL_ROOT_PASSWORD=root-password
NODE_JS_SERVICE_PORT=80
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
_=/usr/bin/env
root@multi-secrets:/#
root@host14-01:/test# kubectl exec multi-secrets -c wordpress -it bash
root@multi-secrets:/var/www/html# env
NODE_JS_PORT_80_TCP=tcp://10.96.94.67:80
HOSTNAME=multi-secrets
NODE_JS_PORT=tcp://10.96.94.67:80
KUBERNETES_PORT=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP_PORT=443
PHP_INI_DIR=/usr/local/etc/php
PHP_ASC_URL=https://secure.php.net/get/php-5.6.31.tar.xz.asc/from/this/mirror
NODE_JS_PORT_80_TCP_PROTO=tcp
KUBERNETES_SERVICE_PORT=443
WORDPRESS_DB_PASSWORD=wordpress-password
KUBERNETES_SERVICE_HOST=10.96.0.1
PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2
NODE_JS_PORT_80_TCP_PORT=80
PHP_MD5=
PHPIZE_DEPS=autoconf dpkg-dev file g++ gcc libc-dev libpcre3-dev make pkg-config re2c
PHP_URL=https://secure.php.net/get/php-5.6.31.tar.xz/from/this/mirror
WORDPRESS_DB_HOST=127.0.0.1
WORDPRESS_VERSION=4.8.2
PHP_LDFLAGS=-Wl,-O1 -Wl,--hash-style=both -pie
APACHE_ENVVARS=/etc/apache2/envvars
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
GPG_KEYS=0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3
PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2
PWD=/var/www/html
WORDPRESS_DB_USER=wordpress
SHLVL=1
HOME=/root
PHP_SHA256=c464af61240a9b7729fabe0314cdbdd5a000a4f0c9bd201f89f8628732fe4ae4
WORDPRESS_SHA1=a99115b3b6d6d7a1eb6c5617d4e8e704ed50f450
KUBERNETES_PORT_443_TCP_PROTO=tcp
APACHE_CONFDIR=/etc/apache2
KUBERNETES_SERVICE_PORT_HTTPS=443
PHP_EXTRA_BUILD_DEPS=apache2-dev
NODE_JS_SERVICE_HOST=10.96.94.67
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
NODE_JS_PORT_80_TCP_ADDR=10.96.94.67
NODE_JS_SERVICE_PORT=80
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
PHP_VERSION=5.6.31
PHP_EXTRA_CONFIGURE_ARGS=--with-apxs2
_=/usr/bin/env
root@multi-secrets:/var/www/html#
'Cloud > docker' 카테고리의 다른 글
docker for linux fundimental (0) | 2018.04.12 |
---|---|
kubernetes (0) | 2018.03.26 |
네트워크 (0) | 2017.10.18 |
3 (0) | 2017.10.18 |
docker 레지스트리 (0) | 2017.10.17 |