본문 바로가기

리눅스

[Kubernetes] kubernetes 애플리케이션 배포 -3

반응형

kubernetes nginx 배포 테스트

 

###네임스페이지 생성
$ kubectl create namespace jenkins-demo
namespace/jenkins-demo created


$ kubectl get namespace
NAME              STATUS   AGE
jenkins-demo      Active   21s

 

 

###jenkins-pv.yaml 편집
$ mkdir jenkins
$ cd jenkins/
$ vim jenkins-pv.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
  name: jenkins-pv
  namespace: pipeline
spec:
  storageClassName: jenkins-pv
  accessModes:
    - ReadWriteOnce
  capacity:
    storage: 20Gi
  persistentVolumeReclaimPolicy: Retain
  hostPath:
    path: /root/kubelabs/jenkins/
    
 ###PersistentVolume 생성
 $ kubectl create -f jenkins-pv.yaml
persistentvolume/jenkins-pv created

$ kubectl get pv --namespace=pipeline
NAME         CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS      CLAIM   STORAGECLASS   REASON   AGE
jenkins-pv   20Gi       RWO            Retain           Available           jenkins-pv              7s

$ kubectl describe pv jenkins-pv --namespace=pipeline
Name:            jenkins-pv
Labels:          <none>
Annotations:     <none>
Finalizers:      [kubernetes.io/pv-protection]
StorageClass:    jenkins-pv
Status:          Available
Claim:           
Reclaim Policy:  Retain
Access Modes:    RWO
VolumeMode:      Filesystem
Capacity:        20Gi
Node Affinity:   <none>
Message:         
Source:
    Type:          HostPath (bare host directory volume)
    Path:          /root/kubelabs/jenkins/
    HostPathType:  
Events:            <none>

 

헬름(helm) 저장소 추가

$ helm repo add stable https://kubernetes-charts.storage.googleapis.com/

$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "brigade" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈Happy Helming!⎈

$ helm search repo stable/jenkins
NAME            CHART VERSION   APP VERSION     DESCRIPTION                                       
stable/jenkins  2.5.4           lts             DEPRECATED - Open source continuous integration...

###https://github.com/helm/charts/blob/master/stable/jenkins/values.yaml
###jenkins-value.yaml 생성

$ helm install demo-jenkins stable/jenkins -f jenkins-value.yaml \
--set persistence.existingClaim=false \
--set master.serviceType=NodePort \
--namespace jenkins-demo
mespace jenkins-demo
WARNING: This chart is deprecated
NAME: demo-jenkins
LAST DEPLOYED: Tue Oct  6 12:51:18 2020
NAMESPACE: jenkins-demo
STATUS: deployed
REVISION: 1
NOTES:
*******************
****DEPRECATED*****
*******************
* The Jenkins chart is deprecated. Future development has been moved to https://github.com/jenkinsci/helm-charts

1. Get your 'admin' user password by running:
  printf $(kubectl get secret --namespace jenkins-demo demo-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo
2. Get the Jenkins URL to visit by running these commands in the same shell:
  export NODE_PORT=$(kubectl get --namespace jenkins-demo -o jsonpath="{.spec.ports[0].nodePort}" services demo-jenkins)
  export NODE_IP=$(kubectl get nodes --namespace jenkins-demo -o jsonpath="{.items[0].status.addresses[0].address}")
  echo http://$NODE_IP:$NODE_PORT/login

3. Login with the password from step 1 and the username: admin

4. Use Jenkins Configuration as Code by specifying configScripts in your values.yaml file, see documentation: http:///configuration-as-code and examples: https://github.com/jenkinsci/configuration-as-code-plugin/tree/master/demos

For more information on running Jenkins on Kubernetes, visit:
https://cloud.google.com/solutions/jenkins-on-container-engine
For more information about Jenkins Configuration as Code, visit:
https://jenkins.io/projects/jcasc/

 

 

728x90
반응형