Followers

Gitlab with Kubernetes

Prerequisite: 3 Vms ubuntu in Aws  1 machine GitLab runner is already running   Step 1: On All the machine install kubernetes agent and comm...

Prerequisite:

3 Vms ubuntu in Aws 

1 machine GitLab runner is already running

 Step 1: On All the machine install kubernetes agent and common components

sudo apt-get update && sudo apt-get install -y apt-transport-https curl

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list

deb https://apt.kubernetes.io/ kubernetes-xenial main

EOF

sudo apt-get update

apt install -qq -y kubeadm=1.21.0-00 kubelet=1.21.0-00 kubectl=1.21.0-00

sudo apt-mark hold kubelet kubeadm kubectl


Step 2: Run below commands on Gitlab server machine

  1. kubeadm init --apiserver-advertise-address=<<Master ServerIP>> --pod-network-cidr=192.168.0.0/16
  2.  mkdir -p $HOME/.kube
  3.  sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  4. sudo chown $(id -u):$(id -g) $HOME/.kube/config
  5. kubectl create -f https://docs.projectcalico.org/v3.18/manifests/calico.yaml
Step 3: Install helm on Master server only.


 curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -

 sudo apt-get install apt-transport-https --yes

 echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list

 sudo apt-get update

 sudo apt-get install helm

Create Deployment

helm create deploy
cd deploy/templates
rm * -ifr

vi deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: capstone-deploy
  labels:
    app: capstone-app
spec:
  replicas: 3
  template:
    metadata:
      labels:
        app: capstone-app
    spec:
      containers:
      - name: container
        image: nginx:1.7.9
        ports:
        - containerPort: 80
  selector:
    matchLabels:
      app: capstone-app


Create a Nodeport service file service.yaml

apiVersion: v1
kind: Service
metadata:
  name: capstone-service
  labels:
    app: capstone-app
spec:
  selector:
    app: capstone-app
  type: NodePort
  ports:
  - nodePort: 31111
    port: 80
    targetPort: 80


Save the file
cd ../..
helm install capstonecharts deploy'
helm list
helm uninstall capstonecharts




COMMENTS

Name

Ansible,6,AWS,1,Azure DevOps,1,Containerization with docker,2,DevOps,2,Docker Quiz,1,Docker Swarm,1,DockerCompose,1,ELK,2,git,2,Jira,1,Kubernetes,1,Kubernetes Quiz,5,SAST DAST Security Testing,1,SonarQube,3,Splunk,2,vagrant kubernetes,1,YAML Basics,1,
ltr
item
DevOpsWorld: Gitlab with Kubernetes
Gitlab with Kubernetes
DevOpsWorld
https://www.devopsworld.co.in/2022/03/gitlab-with-kubernetes.html
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/2022/03/gitlab-with-kubernetes.html
true
5997357714110665304
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content