1. Run the command showing from clicking on the connect button. This will create file in ~/.kube/config file. However this file can not be used directly by kubectl.
2. Run the following command:
kubectl get pods
The above command somehow changed the ./kube/config file adding the access-token and expiry-key. then that file ~/.kube/config
the above will be using access token in the kubeconfig.
You could also use user name and password.
edit the ~/.kube/config file, add the following in the users section of the file
- name: tong
user:
password: xxxxxx
username:xxxxx
The user name and password should come from k8s cluster endpoint show credentials button.
Then in the contexts -> context -> user, use user tong. This will also work.
Thursday, May 31, 2018
Thursday, May 17, 2018
What to do if only want to submit some of the changed files
Assume that you have changed file1, file2, file3 and file4, but you only want to commit file1 and file2, follow the this procedure.
1. Use git add to add individual files to be committed.
git add file1
git add file2
2. The commit the changes.
git commit -s
3. Then stash all the changes.
git stash
4. Now git checkout other files which have been changed to make the work space clean
git checkout -- file3
git checkout -- file4
5. Now your workspace should be clean. Git review the commit
git review
6. Simply do git stash pop to get changes to file3 and file4 back.
git stash pop
1. Use git add to add individual files to be committed.
git add file1
git add file2
2. The commit the changes.
git commit -s
3. Then stash all the changes.
git stash
4. Now git checkout other files which have been changed to make the work space clean
git checkout -- file3
git checkout -- file4
5. Now your workspace should be clean. Git review the commit
git review
6. Simply do git stash pop to get changes to file3 and file4 back.
git stash pop
Use nfs server docker container to set up nfs server
1. Start up a server:
2. Now to mount that share, a client using ubuntu will need to have nfs-common installed.
now mount the share to a directory named test
now dismount the share.
These mounted directory owned by root, can only be changed by root users.
docker run -d --name nfs --privileged --net=host \ -v /home/ubuntu/logs:/nfsshare -e SHARED_DIRECTORY=/nfsshare \ itsthenetwork/nfs-server-alpine:latest
2. Now to mount that share, a client using ubuntu will need to have nfs-common installed.
sudo apt install -y nfs-common
now mount the share to a directory named test
sudo mount -v 192.168.56.106:/ test
now dismount the share.
sudo umount test
These mounted directory owned by root, can only be changed by root users.
Wednesday, May 9, 2018
Script to run a job every 5 minutes
#!/bin/bash cd /home/ibmadmin/hl/src/hfrd if git diff-index --quiet HEAD --; then # No changes echo 'not changes' else # We have some changes, rebuild the api server docker image git pull make api-docker docker restart hfrdserver # Sync to the mirror git server eval $(ssh-agent -s) ssh-add /home/ibmadmin/.ssh/fd cd /home/ibmadmin/gitserver/hfrd.git git fetch git push --mirror ssh://git@9.42.91.228:2222/git-server/repos/hfrd.git kill -9 $SSH_AGENT_PID fi cd /home/ibmadmin/gitserver/synch at now + 5 minute -f thesync.sh > next.log 2>&1at command is to schedule
atq to query
atrm to delete
Tuesday, May 1, 2018
Start jenkins using container
The procedure to setup a jenkins server using docker container
1. Create the following directory, assume you are at your home directory:
2. Run the following command to start up the git server:
http://<hostip>:9090
The first time access it, you will have to find the initial admin pw and do the setup. All the jenkins files will be at ~/jenkins/jenkins_home
You can then add that host as the jenkins slave to start run your jobs.
1. Create the following directory, assume you are at your home directory:
$ mkdir -p ~/jenkins/jenkins_home
2. Run the following command to start up the git server:
docker run -d -p 9090:8080 -p 50000:50000 \ --restart unless-stopped \ -v ~/jenkins/jenkins_home:/var/jenkins_home \ --name jenkins jenkins/jenkins:ltsNow your server is running at the port 9090. Use the following url to access its UI.
http://<hostip>:9090
The first time access it, you will have to find the initial admin pw and do the setup. All the jenkins files will be at ~/jenkins/jenkins_home
You can then add that host as the jenkins slave to start run your jobs.
Subscribe to:
Posts (Atom)